zxhxx il y a 1 an
Parent
commit
1545df7938

+ 4 - 4
Controller/Customer/Customer.Class.php

@@ -937,10 +937,10 @@ class Customer extends BaseController
             'orderIds'      =>'',
             'remark'     => '充值'.$params['money'],
             'financeType' => '会员余额充值',
-            'accountId' => isset($params['accountId']) ? $params['accountId']: 0,
-            'accountName' => isset($params['accountName']) ? $params['accountName']: '',
-            'accountNumber' => isset($params['accountNumber']) ? $params['accountNumber']: '',
-            'explain'      => isset($params['explain']) ? $params['explain']: '',
+            'accountId' =>  0,
+            'accountName' =>  '',
+            'accountNumber' => '',
+            'explain'      => '',
         ];
         foreach ($memberBalanceDetailData as $k =>$v) {//,'accountId','accountName','accountNumber'
             if(in_array($k, ['customerId','money','purpose']) && empty($v)) {

+ 5 - 1
Controller/Shop/Shop.Class.php

@@ -8,6 +8,7 @@
  */
 namespace JinDouYun\Controller\Shop;
 
+use JinDouYun\Model\Customer\MCustomer;
 use JinDouYun\Model\Enterprise\MEnterprise;
 use Mall\Framework\Core\ErrorCode;
 use Mall\Framework\Core\ResultWrapper;
@@ -23,11 +24,13 @@ class Shop extends BaseController
     private $objMShop;
     private $objShopCache;
     private $objTempSaveCache;
+    private $objMCustomer;
 
     public function __construct($isCheckAcl = true, $isMustLogin = true)
     {
         parent::__construct($isCheckAcl, $isMustLogin);
         $this->objMShop = new MShop($this->onlineEnterpriseId, $this->onlineUserId);
+        $this->objMCustomer = new MCustomer($this->onlineEnterpriseId, $this->onlineUserId);
         $this->objShopCache = new ShopCache();
         $this->objTempSaveCache = new TempSaveCache();
     }
@@ -87,7 +90,8 @@ class Shop extends BaseController
 
         $shopData['longitude'] = isset($params['longitude']) ? $params['longitude'] : 0;//商铺坐标
         $shopData['latitude'] = isset($params['latitude']) ? $params['latitude'] : 0;
-
+        $shopData['recommend_user_id'] = isset($params['recommend_user_id']) ? $params['recommend_user_id'] : 0;
+        $shopData['recommend_user_id'] = isset($params['recommend_user_id']) ? $params['recommend_user_id'] : 0;
         $shopData['deleteStatus']= StatusCode::$standard;
         $shopData['enableStatus']= isset($params['enableStatus']) ? $params['enableStatus'] : StatusCode::$standard;
         $shopData['createTime'] = time();

+ 2 - 1
Dao/Shop/DShop.Class.php

@@ -46,7 +46,8 @@ class DShop extends BaseDao
             "managerId", //int(11) DEFAULT NULL COMMENT '店长userCenterId',
             "describe", //varchar(255) DEFAULT '' COMMENT '店铺描述',
             "extends",
-            "modelType"
+            "modelType",
+            "recommend_user_id"
         ];
         $this->_readonly = ['id'];
         $this->_create_autofill = [

+ 1 - 0
Model/Customer/MCustomer.Class.php

@@ -946,6 +946,7 @@ class MCustomer extends MBaseModel
         return ResultWrapper::success(count((array)$dbResult));
     }
 
+
     /**
      * 不同状态下用户的数量
      * @return ResultWrapper

+ 27 - 0
Model/Shop/MShop.Class.php

@@ -16,6 +16,8 @@ use JinDouYun\Dao\Department\DStaff;
 use JinDouYun\Dao\GoodsManage\DGoodsBasic;
 use JinDouYun\Dao\UserCenter\DUserCenter;
 use JinDouYun\Model\Common\Location;
+use JinDouYun\Model\Customer\MMemberBalanceDetail;
+use JinDouYun\Model\System\MBasicSetup;
 use Mall\Framework\Core\ErrorCode;
 use Mall\Framework\Core\StatusCode;
 use Mall\Framework\Core\ResultWrapper;
@@ -53,6 +55,7 @@ class MShop extends MBaseModel
     private $objShopCache;
     private $objMEnterprise;
     private $objMStaff;
+    private $objMMemberBalanceDetail;
 
     public function __construct($enterpriseId, $userCenterId = '')
     {
@@ -67,6 +70,7 @@ class MShop extends MBaseModel
         $this->objShopCache = new ShopCache();
         $this->objMEnterprise = new MEnterprise();
         $this->objMStaff = new MStaff($enterpriseId,$userCenterId);
+        $this->objMMemberBalanceDetail  = new MMemberBalanceDetail($enterpriseId,$userCenterId);
 
         $tableName = $this->objDShop->getTableName('qianniao_shop', $this->enterpriseId, $this->cutTable);
         $this->objDShop->setTable($tableName);
@@ -142,6 +146,29 @@ class MShop extends MBaseModel
             $this->objDShop->rollBack();
             return ResultWrapper::fail($this->objDEnterpriseBindShop->error(),ErrorCode::$dberror);
         }
+        if($params['recommend_user_id']>0)
+        {
+            $objMBasicSetup = new MBasicSetup($this->enterpriseId);
+            $memberBalanceDetailData = [
+                'customerId' => $params['customerId'],
+                'type'       => 5,
+                'userCenterId' => $params['recommend_user_id'],
+                'money'         => $objMBasicSetup->getBasicField('yhtjmd')->getData(),
+                'purpose'    =>  '推荐门店获得',
+                'orderIds'      =>'',
+                'remark'     => '推荐门店获得'.$objMBasicSetup->getBasicField('yhtjmd')->getData(),
+                'financeType' => '推荐门店获得',
+                'accountId' => isset($params['accountId']) ? $params['accountId']: 0,
+                'accountName' => isset($params['accountName']) ? $params['accountName']: '',
+                'accountNumber' => isset($params['accountNumber']) ? $params['accountNumber']: '',
+                'explain'      => isset($params['explain']) ? $params['explain']: '',
+            ];
+            $result = $this->objMMemberBalanceDetail->addMemberBalanceDetail($memberBalanceDetailData,$isbackstage=true);
+            if($result) {
+                $this->objDShop > update(['is_send' => 1], ['id' => $ShopId]);
+            }
+        }
+
 
         /*//自动创建仓库
         $wareHouseParam = [