| | |
| | | |
| | | namespace app\api\model\supplier; |
| | | |
| | | use app\common\model\plus\shareholder\Apply as ShareholderApplyModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | | 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; |
| | | /** |
| | | * 供应商模型类 |
| | | */ |
| | |
| | | $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']); |
| | | //根据团队人数判断股东 by yj |
| | | $shareholderModel = new ShareholderApplyModel; |
| | | $shareholderModel->becomeShareholderByTeam($data['referee_id'], 80, $data['app_id']); |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | |
| | | public function getDetail($data, $user) |
| | | { |
| | | $detail = $this->alias('s')->where(['shop_supplier_id' => $data['shop_supplier_id']]) |
| | | ->field("name as store_name,shop_supplier_id,logo_id,category_id,server_score,fav_count,user_id,product_sales,address,notice") |
| | | ->field("name as store_name,shop_supplier_id,logo_id,category_id,server_score,fav_count,user_id,product_sales,address,notice,description") |
| | | ->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']); |
| | |
| | | ->where('s.is_delete', '=', '0') |
| | | ->where('s.is_recycle', '=', 0) |
| | | //->where('s.is_full', '=', 1) |
| | | ->field("s.shop_supplier_id,s.name,s.fav_count,logo_id,category_id,server_score,product_sales") |
| | | ->field("s.shop_supplier_id,s.name,s.fav_count,logo_id,category_id,server_score,product_sales,address,link_phone,longitude,latitude") |
| | | ->order($sort) |
| | | ->paginate($param); |
| | | $product_model = new ProductModel(); |
| | |
| | | $v['productList'] = $productList; |
| | | $v['logos'] = isset($v['logo'])?$v['logo']['file_path']:''; |
| | | $v['category_name'] = $v['category']['name']; |
| | | $v['latitude'] = (float)$v['latitude']; |
| | | $v['longitude'] = (float)$v['longitude']; |
| | | unset($v['logo']); |
| | | unset($v['category']); |
| | | } |
| | |
| | | $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(); |
| | | } |
| | | } |