yingzi 2 年之前
父节点
当前提交
cb7c950c67
共有 2 个文件被更改,包括 86 次插入0 次删除
  1. 37 0
      Controller/Common/ApiTest.php
  2. 49 0
      Util/Common/PartnerTool.class.php

+ 37 - 0
Controller/Common/ApiTest.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * 测试
+ * Created by PhpStorm.
+ * Date=> 2020/05/16
+ * Time=> 11=>31
+ */
+
+namespace Jindouyun\Controller\Common;
+
+
+use Mall\Framework\Core\ErrorCode;
+use Mall\Framework\Cache\Redis;
+use Mall\Framework\Core\ResultWrapper;
+use Mall\Framework\Core\StatusCode;
+use Mall\Framework\Factory;
+
+use Util\Common\PartnerTool;
+
+
+
+
+class Test  extends BaseController
+{
+
+   public function __construct($isCheckAcl = true, $isMustLogin = true)
+    {
+        parent::__construct($isCheckAcl, $isMustLogin);
+    }
+
+
+    public function tool()
+    {
+        $to = new PartnerTool($this->onlineEnterpriseId);
+        $to->setPushCustomer(1,29);
+    }
+}

+ 49 - 0
Util/Common/PartnerTool.class.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace Util\Common;
+
+use JinDouYun\Dao\Customer\DCustomer;
+use JinDouYun\Cache\CustomerCache;
+
+class PartnerTool{
+    private $dbCustomer;
+    private $enterpriseId;
+    private $cutTable = 1;//客户按照企业id分表
+    public function __construct($enterpriseId){
+        $this->enterpriseId = $enterpriseId;
+        $this->dbCustomer = new DCustomer('default');
+        $tableName = $this->dbCustomer->getTableName($this->dbCustomer->get_Table(), $this->enterpriseId, $this->cutTable);
+        $this->objDCustomer->setTable($tableName);
+    }
+    
+    
+    public function setPushCustomer($parentId=0,$childId=0){
+        if($parentId == 0 || $childId == 0 || $parentId == $childId){
+            return false;
+        }
+        $childData = $this->dbCustomer->get($childId);
+        var_dump($childData);
+        if (empty($childData)) {
+            return false;
+        }
+
+        
+        return true;
+        
+//        $beginStatus = $this->dbCustomer->beginTransaction();
+//        $this->dbCustomer->rollBack();
+//        $beginStatus && $this->dbCustomer->commit();
+        
+        
+        
+    }
+    public function delCustomerCache(){
+        $enterpriseId = 0;
+        $customerId = 0;
+        $userCenterId = 0;
+        $objCustomerCache = new CustomerCache();
+        $objCustomerCache->delCustomerData($enterpriseId, $customerId);
+        $objCustomerCache->delCustomerUserData($enterpriseId, $userCenterId);
+    }
+}
+