quanwei
2025-11-28 3ea53e61cc23fdb3ddf8b38a199ca60a6da8c407
admin/app/api/model/supplier/Supplier.php
@@ -6,7 +6,7 @@
use app\common\model\supplier\User as SupplierUserModel;
use app\api\model\user\Favorite as FavoriteModel;
use app\api\model\product\Product as ProductModel;
use app\api\model\plus\team\Apply as teamApplyModel;
/**
 * 供应商模型类
 */
@@ -31,6 +31,7 @@
            $data['shop_supplier_id'] = $this['shop_supplier_id'];
            $data['is_super'] = 1;
            $SupplierUserModel->save($data);
            (new teamApplyModel())->becomeTeamByAgent($data['referee_id'],70,$data['app_id']);
            $this->commit();
            return true;
        } catch (\Exception $e) {
@@ -53,7 +54,7 @@
            ->with(['logo', 'category'])
            ->find();
        if ($detail) {
            $detail['logos'] = $detail['logo']['file_path'];
            $detail['logos'] = $detail['logo']?$detail['logo']['file_path']:'';
            $detail['category_name'] = $detail['category']['name'];
            unset($detail['logo']);
            unset($detail['category']);
@@ -172,4 +173,25 @@
        $data["index"]=empty($index) ? '-1' : $index;
        return $data;
    }
    //店铺列表(简约)
    public function getListSimple($params = [])
    {
        $model = $this;
        if (!empty($params['keyword'])) {
            $model = $model->where('name', 'like', '%'. $params['keyword'] .'%');
        }
        return $model->where('is_delete', '=', '0')
            ->where('is_recycle', '=', 0)
            ->order(['create_time' => 'desc'])
            ->paginate($params);
    }
    public static function getUserStore($user_id)
    {
        $model = new self();
        return $model->where('user_id', '=', $user_id)
            ->where('is_delete', '=', 0)
            ->where('is_recycle', '=', 0)
            ->find();
    }
}