PartnerTools.Class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Util\Common;
  3. use JinDouYun\Dao\Customer\DCustomer;
  4. use JinDouYun\Cache\CustomerCache;
  5. class PartnerTools{
  6. private $dbCustomer;
  7. private $enterpriseId;
  8. private $cutTable = 1;//客户按照企业id分表
  9. public function __construct($enterpriseId){
  10. $this->enterpriseId = $enterpriseId;
  11. $this->dbCustomer = new DCustomer('default');
  12. $tableName = $this->dbCustomer->getTableName($this->dbCustomer->get_Table(), $this->enterpriseId, $this->cutTable);
  13. $this->dbCustomer->setTable($tableName);
  14. }
  15. public function setPushCustomer($parentId=0,$childId=0){
  16. if($parentId == 0 || $childId == 0 || $parentId == $childId){
  17. return false;
  18. }
  19. $childData = $this->dbCustomer->get($childId);
  20. var_dump($childData);
  21. if (empty($childData)) {
  22. return false;
  23. }
  24. return true;
  25. // $beginStatus = $this->dbCustomer->beginTransaction();
  26. // $this->dbCustomer->rollBack();
  27. // $beginStatus && $this->dbCustomer->commit();
  28. }
  29. public function delCustomerCache(){
  30. $enterpriseId = 0;
  31. $customerId = 0;
  32. $userCenterId = 0;
  33. $objCustomerCache = new CustomerCache();
  34. $objCustomerCache->delCustomerData($enterpriseId, $customerId);
  35. $objCustomerCache->delCustomerUserData($enterpriseId, $userCenterId);
  36. }
  37. }