diff --git a/app/common/model/store/product/Product.php b/app/common/model/store/product/Product.php index 3df6a25..2841bab 100644 --- a/app/common/model/store/product/Product.php +++ b/app/common/model/store/product/Product.php @@ -347,6 +347,12 @@ class Product extends BaseModel return 0; } + public function getAgentTwoIdsAttr($value){ + if($value) return explode(',',$value); + else return []; + } + + /* * ----------------------------------------------------------------------------------------------------------------- * 关联模型 diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index a7f0dcc..b5b827e 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -243,7 +243,7 @@ class User extends BaseModel return !empty($info) ? $info->toArray() : null; } - + // 用户是否存在烟酒店 有效店员信息 public function getSmokeMerServiceAttr(){ $info = (new StoreService()) ->field('service_id,uid,nickname,avatar,customer,StoreService.mer_id,is_verify,is_goods,is_open') @@ -263,6 +263,26 @@ class User extends BaseModel return !empty($info) ? $info->toArray() : null; } + // 用户是否存在超市 有效店员信息 + public function getSupermarketServiceAttr(){ + $info = (new StoreService()) + ->field('service_id,uid,nickname,avatar,customer,StoreService.mer_id,is_verify,is_goods,is_open') + ->hasWhere('merchant',function($query){ + $query->where('is_del', 0) + ->where('mer_state', 1) + ->where('merchant_type', 4) + ->where('status', 1); + }) + ->where('uid',$this->uid) + ->where('StoreService.mer_id','<>',0) + ->where('StoreService.is_del',0) + ->where('is_open',1) + ->order('StoreService.is_verify DESC,StoreService.customer DESC') + // ->fetchSql() + ->find(); + + return !empty($info) ? $info->toArray() : null; + } diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 527521f..214038c 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -87,6 +87,7 @@ class ProductRepository extends BaseRepository ['is_batch',0], ['batch_num',0], ['batch_unit',''], + ['agent_two_ids',[]], ]; protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,Product.ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type'; protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,Product.ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type'; @@ -530,6 +531,7 @@ class ProductRepository extends BaseRepository 'is_batch' => $data['is_batch'] ?? 0, 'batch_num' => $data['batch_num'] ?? 0, 'batch_unit' => $data['batch_unit'] ?? '', + 'agent_two_ids' => is_array($data['agent_two_ids']) ? implode(',',$data['agent_two_ids']) : $data['agent_two_ids'], ]; if (isset($data['extend'])) $result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : ''; if (isset($data['mer_id'])) $result['mer_id'] = $data['mer_id']; diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 20cd090..92e98df 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -147,7 +147,7 @@ class Auth extends BaseController public function userInfo() { $user = $this->request->userInfo()->hidden(['label_id', 'group_id', 'pwd', 'addres', 'card_id', 'last_time', 'last_ip', 'create_time', 'mark', 'status', 'spread_uid', 'spread_time', 'real_name', 'birthday', 'brokerage_price']); - $user->append(['service', 'topService','shopMerService','smokeMerService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral']); + $user->append(['service', 'topService','shopMerService','supermarketService','smokeMerService', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread', 'total_recharge', 'lock_integral', 'total_integral']); $data = $user->toArray(); $data['total_consume'] = $user['pay_price']; $data['extension_status'] = systemConfig('extension_status');