yingzi 1 year ago
parent
commit
b46429f338
100 changed files with 0 additions and 20503 deletions
  1. 0 208
      .ENV.php
  2. 0 7
      .gitignore
  3. 0 1
      .htaccess
  4. 0 1
      .user.ini
  5. 0 7
      404.html
  6. 0 185
      Cache/ActivityLimitCache.Class.php
  7. 0 81
      Cache/AllTableNameCache.Class.php
  8. 0 132
      Cache/CacheMan.Class.php
  9. 0 76
      Cache/CartCache.Class.php
  10. 0 52
      Cache/CollectCache.Class.php
  11. 0 206
      Cache/CommissionCache.Class.php
  12. 0 300
      Cache/CustomerCache.Class.php
  13. 0 182
      Cache/EnterpriseCache.Class.php
  14. 0 202
      Cache/FinanceCache.Class.php
  15. 0 132
      Cache/GoodsBasicCache.Class.php
  16. 0 330
      Cache/GoodsBasicRelevant.Class.php
  17. 0 118
      Cache/InventoryCache.Class.php
  18. 0 81
      Cache/MerchantCache.Class.php
  19. 0 518
      Cache/OverviewCache.Class.php
  20. 0 77
      Cache/PageCache.Class.php
  21. 0 118
      Cache/PauseSave.Class.php
  22. 0 211
      Cache/PriceCache.Class.php
  23. 0 326
      Cache/RoleAclCache.Class.php
  24. 0 111
      Cache/ShopCache.Class.php
  25. 0 121
      Cache/SkuCache.Class.php
  26. 0 80
      Cache/SmsVerification.Class.php
  27. 0 93
      Cache/SpecCache.Class.php
  28. 0 139
      Cache/Stock.Class.php
  29. 0 47
      Cache/SupplierCache.Class.php
  30. 0 245
      Cache/SysAreaChinaCache.Class.php
  31. 0 214
      Cache/SystemCache.Class.php
  32. 0 176
      Cache/TempSaveCache.Class.php
  33. 0 415
      Config/Config.php
  34. 0 417
      Config/Config_local.php
  35. 0 346
      Controller/Agent/Agents.Class.php
  36. 0 346
      Controller/Api/System.Class.php
  37. 0 542
      Controller/BaseController.Class.php
  38. 0 167
      Controller/BlockManage/Element.Class.php
  39. 0 152
      Controller/BlockManage/Zone.Class.php
  40. 0 305
      Controller/Cart/ApiCart.Class.php
  41. 0 224
      Controller/Cart/Cart.Class.php
  42. 0 74
      Controller/Cart/TestCart.Class.php
  43. 0 478
      Controller/Cashier/Cashier.Class.php
  44. 0 3
      Controller/Cashier/Cashier.md
  45. 0 118
      Controller/Cashier/CashierGoods.Class.php
  46. 0 117
      Controller/Cashier/Guide.Class.php
  47. 0 179
      Controller/Cashier/PushMoney.Class.php
  48. 0 64
      Controller/Cashier/Settings.Class.php
  49. 0 198
      Controller/Charts/Charts.Class.php
  50. 0 296
      Controller/Commission/ApiCommissionBusinessman.Class.php
  51. 0 69
      Controller/Commission/ApiCommissionSetting.Class.php
  52. 0 117
      Controller/Commission/ApiCommissionWithdrawals.Class.php
  53. 0 99
      Controller/Commission/Commission.Class.php
  54. 0 302
      Controller/Commission/CommissionBusinessman.Class.php
  55. 0 165
      Controller/Commission/CommissionGoods.Class.php
  56. 0 153
      Controller/Commission/CommissionGrade.Class.php
  57. 0 60
      Controller/Commission/CommissionOrder.Class.php
  58. 0 134
      Controller/Commission/CommissionSetting.Class.php
  59. 0 87
      Controller/Commission/CommissionWithdrawals.Class.php
  60. 0 225
      Controller/Common/AliPayNotify.Class.php
  61. 0 57
      Controller/Common/ApiTestCom.Class.php
  62. 0 172
      Controller/Common/CloudPrint.Class.php
  63. 0 42
      Controller/Common/Common.Class.php
  64. 0 1251
      Controller/Common/ESinit.Class.php
  65. 0 297
      Controller/Common/EasyTest.Class.php
  66. 0 42
      Controller/Common/EnterpriseCategory.Class.php
  67. 0 35
      Controller/Common/FormatGoodsBasic.Class.php
  68. 0 79
      Controller/Common/Logger.Class.php
  69. 0 323
      Controller/Common/Login.Class.php
  70. 0 149
      Controller/Common/PauseSave.Class.php
  71. 0 147
      Controller/Common/Pay.Class.php
  72. 0 49
      Controller/Common/PrintNum.Class.php
  73. 0 69
      Controller/Common/Receipt.Class.php
  74. 0 188
      Controller/Common/SmsCode.Class.php
  75. 0 113
      Controller/Common/Sql.Class.php
  76. 0 104
      Controller/Common/SysAreaChina.Class.php
  77. 0 1436
      Controller/Common/Test.Class.php
  78. 0 62
      Controller/Common/Tools.Class.php
  79. 0 93
      Controller/Common/Upgrade.Class.php
  80. 0 129
      Controller/Common/Upload.Class.php
  81. 0 38
      Controller/Common/Video.Class.php
  82. 0 452
      Controller/Common/WeiXinOpen.Class.php
  83. 0 366
      Controller/Common/WeiXinPayNotify.Class.php
  84. 0 289
      Controller/Common/XinHongTai.Class.php
  85. 0 46
      Controller/Cron/CouponCron.Class.php
  86. 0 32
      Controller/Cron/Cron.Class.php
  87. 0 109
      Controller/Cron/CustomerCron.Class.php
  88. 0 133
      Controller/Cron/DelayQueueOrder.Class.php
  89. 0 138
      Controller/Cron/FinanceCron.Class.php
  90. 0 71
      Controller/Cron/GetWxAuditStatus.Class.php
  91. 0 54
      Controller/Cron/NewCommissionCron.Class.php
  92. 0 314
      Controller/Cron/OrderCron.Class.php
  93. 0 79
      Controller/Cron/PriceCron.Class.php
  94. 0 106
      Controller/Cron/PullWxInfo.Class.php
  95. 0 213
      Controller/Cron/SupplierPurchaseCron.Class.php
  96. 0 576
      Controller/Customer/ApiCustomer.Class.php
  97. 0 1298
      Controller/Customer/Customer.Class.php
  98. 0 288
      Controller/Customer/CustomerCard.Class.php
  99. 0 253
      Controller/Customer/CustomerCommunication.Class.php
  100. 0 182
      Controller/Customer/CustomerContact.Class.php

+ 0 - 208
.ENV.php

@@ -1,208 +0,0 @@
-<?php
-/**
- * 基础常量
- */
-// 项目根目录
-define('PROJECT_PATH', __DIR__);
-// 项目名称
-define('PROJECT_NAME', 'JinDouYun');
-// 项目域名
-define('PROJECT_DOMAIN', 'api');
-// 项目在权限系统编号
-define('PROJECT_ACL_NO', '1');
-// 默认模块名
-define('DEFAULT_CLASS_MODULE_NAME', 'index');
-// 默认控制器
-define('DEFAULT_CLASS_CONTROLLER_NAME', 'index');
-// 默认方法名
-define('DEFAULT_CLASS_ACTION_NAME', 'index');
-
-
-/**
- * 域名
- */
-// 根域名
-define('DOMAIN', 'api1.liuniukj.com');
-
-define('MP_DOMAIN', 'apiqnys.liuniukj.com');//小程序接口域名
-
-/* 域名后缀 */
-define('DOMAIN_SUFFIX', '.' . DOMAIN);
-// 项目域名
-define('DOMAIN_PROJECT', strtolower(PROJECT_DOMAIN) . DOMAIN_SUFFIX);
-// 配置项目资源域名
-define('DOMAIN_PROJECT_IMG', strtolower(PROJECT_NAME). '.res' . DOMAIN_SUFFIX);
-// 上传附件资源域名
-define('DOMAIN_UPLOAD', 'upload' . DOMAIN_SUFFIX);
-// 前端域名
-define('DOMAIN_WWW', 'www' . DOMAIN_SUFFIX);
-
-/**
- * URL
- * 必须以 / 结尾
- */
-// http协议
-define('AGREEMENT', 'http://');
-// https协议
-define('AGREEMENTSSL', 'https://');
-// 项目地址
-define('URL_PROJECT', AGREEMENT . DOMAIN_PROJECT);
-
-
-//支付回调
-define('PAY_NOTIFY_URL', AGREEMENTSSL . "apiqnys.liuniukj.com");
-
-
-// 项目资源地址
-define('URL_PROJECT_RES',  AGREEMENT . DOMAIN_PROJECT_IMG . '/');
-// 阿里云请求主域名
-define('URL_ALI_SERVICE', AGREEMENT . 'ali' . DOMAIN_SUFFIX);
-// 上传附件资源域名
-define('URL_UPLOAD', AGREEMENTSSL . DOMAIN_UPLOAD . '/');
-// Mobile Web分享
-define('URL_SHARE_MOBILE', AGREEMENT . 'share' . DOMAIN_SUFFIX . '/');
-// android 下载地址
-define('URL_ANDROID_DOWNLOAD', 'http://a.app.qq.com/o/simple.jsp?pkgname=com.maoguang.catmall');
-// ios 下载地址
-define('URL_IOS_DOWNLOAD', 'http://www.mallguang.com');
-// 队列处理地址
-define('QIANNIAO_QUEUE', 'http://queueqnys.liuniukj.com');
-//七牛上传域名
-define('QINIU_UPLOAD', 'https://upload-z0.qiniup.com');
-//七牛图片
-define('QINIU_IMAGE', 'http://up.liuniukj.com');
-
-//钉钉AppKey
-define('DING_KEY', 'dingxipi1agktpmfqfsn');
-//钉钉AppSecret
-define('DING_SECRET', 'eVLaw8zj1Lo2wFmYRHwFvIgyarLkjycwR1L5Bmr0Lbri1pPQhCSh3-Pfga3NkzUK');
-//钉钉CorpId
-define('DING_CORPID', 'ding61c54d96d04f9b6bffe93478753d9884');
-//钉钉SSOsecret
-define('DING_SSO_SECRET', 'kdOCbXmYneYIY2JGbXNQCl8CW300T2v3vy537yi_RX1IzVrf7u_86C-H-OpJ2BSy');
-
-/**
- * Smarty
- * 模板引擎配置
- */
-// 模板存放目录
-define('SMARTY_TEMPLATE_DIR', PROJECT_PATH . DS . 'View' . DS . 'Templates');
-// 模板编译目录
-define('SMARTY_COMPILE_DIR', PROJECT_PATH . DS . 'Storage' . DS . 'Views');
-// 模板缓存目录
-define('SMARTY_CACHE_DIR', PROJECT_PATH . DS . 'Storage' . DS . 'Views');
-// 模板后缀
-define('SMARTY_TEMPLATE_TYPE', '.html');
-// 模板缓存是否开启
-define('SMARTY_IS_CACHE', FALSE);
-
-
-/**
- * DB
- * 数据库引擎配置
- */
-// 数据库引擎名称,首字母大写
-define('DB_DIRVER', 'Pdo');
-// 数据库服务IP地址
-define('DB_HOST', '47.104.177.139');
-// 数据库服务端口号
-define('DB_PORT', '3306');
-// 数据库服务用户名
-define('DB_USERNAME', 'mallguang');
-// 数据库服务密码
-define('DB_PASSWORD', 'zxcvbnm');
-// 数据库名称
-define('DB_NAME', 'shop');
-// 数据库字符编码
-define('DB_CHARSET', 'utf-8');
-
-/**
- * Cookie
- */
-define('COOKIE_PREFIX', 'mallguang_');
-define('COOKIE_PATH', '/');
-define('COOKIE_DOMAIN', DOMAIN_SUFFIX);
-
-/**
- * Mail
- */
-/**
- * 邮件发送方式
- * 1.使用PHP的mail函数发送
- * 2.通过 SOCKET 连接 SMTP 服务器发送(支持 ESMTP 验证, 推荐方法)
- * 3.邮件发送方式1. 使用PHP的mail函数发送2.通过SOCKET 连接 SMTP 服务器发送(支持 ESMTP 验证, 推荐方法)
- */
-define('MAIL_MAILER', 2);
-/**
- * 分隔符
- * 使用 CRLF 作为分隔符(常用, SMTP方式默认分割符)
- * 使用 LF 作为分隔符(一些Unix主机使用mail函数时需用LF替代CRLF)
- * 使用 CR 作为分隔符(通常为 Mac 主机, 不常用)
- */
-define('MAIL_DELIMITER', 1);
-// 字符集
-define('MAIL_CHARSET', 'utf-8');
-// 发件人邮箱
-define('MAIL_FROM', 'qlxbaa@163.com');
-// 是否需要鉴权
-define('MAIL_SIGN', FALSE);
-// Smtp 服务地址
-define('MAIL_SMTP_HOST', 'smtp.163.com');
-// Smtp 服务端口
-define('MAIL_SMTP_PORT', 25);
-// Smtp 身份验证
-define('MAIL_SMTP_AUTH', 1);
-// Smtp 用户名
-define('MAIL_SMTP_USERNAME', 'qlxbaa@163.com');
-// Smtp 密码
-define('MAIL_SMTP_PASSWORD', '8879288aaa');
-// 内容是否Base64
-define('MAIL_CONTENT_BASE64', FALSE);
-
-/**
- * Session
- */
-// Session引擎
-define('SESSION_SAVE_HANDLER', 'redis');
-// 存放地址
-define('SESSION_SAVE_PATH',  'tcp://127.0.0.1:6379?auth=&databases=2&weight=1&timeout=1&prefix=BackendSession:');
-// 数据在服务器端储存有效期
-define('SESSION_GC_MAXLIFETIME', 3600);
-// 客户端的缓存方式,有nocache,private,private_no_expire,publice
-define('SESSION_CACHE_LIMITER', 'nocache');
-// cookie 值生存周期
-define('SESSION_CACHE_EXPIRE', 60);
-// cookie 域名
-define('SESSION_COOKIE_DOMAIN', DOMAIN_SUFFIX);
-// cookie 路径
-define('SESSION_COOKIE_PATH', '/');
-// cookie 数据存储有效期
-define('SESSION_COOKIE_LIFETIME', 0);
-
-/** 附加常量 **/
-
-define('SOOOLE_SOURCE', "qianniaoSAAS");//websocket平台标识,和后台前端设置一样的
-
-/**
- * 时间戳
- */
-define('TIME', time());
-
-/**
- * 站点加密SECRET
- */
-define('SITE_SECRET', 'uhW2XlE4OCz5pW6Hf3USOWaeWAVqsjoJ');
-
-/**
- * Upload File Path
- */
-// define('UPLOAD_FILE_PATH', '/apps/devapi.qianniao.vip/Public/upload/');
-define('UPLOAD_FILE_PATH', PROJECT_PATH . DS.'Public/www/upload/file/');
-
-//小程序文件链接
-define('MP_FILE_URL', AGREEMENTSSL.MP_DOMAIN.'/upload/file/');
-
-/**
- * default member avatar path
- */
-define('DEFAULT_MEMBER_AVATAR', URL_UPLOAD.'defaultavatar.png');

+ 0 - 7
.gitignore

@@ -1,7 +0,0 @@
-.DS_Store
-.idea/
-.Public/upload/
-
-/Public/upload
-upload
-/nbproject/

+ 0 - 1
.htaccess

@@ -1 +0,0 @@
- 

+ 0 - 1
.user.ini

@@ -1 +0,0 @@
-open_basedir=/www/wwwroot/apiqnys.liuniukj.com/:/tmp/

+ 0 - 7
404.html

@@ -1,7 +0,0 @@
-<html>
-<head><title>404 Not Found</title></head>
-<body>
-<center><h1>404 Not Found</h1></center>
-<hr><center>nginx</center>
-</body>
-</html>

+ 0 - 185
Cache/ActivityLimitCache.Class.php

@@ -1,185 +0,0 @@
-<?php
-/**
- * 秒杀活动限购
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2020/4/27
- * Time: 10:30
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Factory;
-
-class ActivityLimitCache
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    private $enterpriseId;
-
-    private static $goodsLimitKey = 'list';
-
-    private static $userLimitTable = 'table';
-
-    private static $activityDetails = 'details';
-
-    /**
-     * ActivityLimitCache constructor.
-     * @param $enterpriseId
-     * @throws \Exception
-     */
-    public function __construct($enterpriseId)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('activity');
-    }
-
-
-    /**************************************秒杀商品总数量 start********************************************************/
-
-    /**
-     * @param $activityId
-     * @param $goodsId
-     * @return string
-     */
-    public function createListKey($activityId, $goodsId,$skuId)
-    {
-        return $this->enterpriseId . '_' . $activityId . '_' . $goodsId . '_' .$skuId.'_'. self::$goodsLimitKey;
-    }
-
-    /**
-     * 插入链表d
-     * @param $activityId
-     * @param $goodsId
-     * @param array $value
-     * @return mixed
-     */
-    public function lPush($activityId, $goodsId, $skuId,array $value)
-    {
-        $key = self::createListKey($activityId, $goodsId,$skuId);
-        $dbResult = false;
-        foreach ($value as $val) {
-            $dbResult = $this->cache->push($key, $val, 'start');
-        }
-        return $dbResult;
-    }
-
-    /**
-     * 减商品限购数量
-     * @param $activityId
-     * @param $goodsId
-     * @param int $number
-     * @return array
-     */
-    public function rPop($activityId, $goodsId, $skuId,$number = 1)
-    {
-        $key = self::createListKey($activityId, $goodsId,$skuId);
-        $result = [];
-        for ($i = 0; $i < $number; $i++) {
-            if ($value = $this->cache->pop($key, 'end')) {
-                $result[] = $value;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * 秒杀活动商品剩余数量
-     * @param $activityId
-     * @param $goodsId
-     * @param $skuId
-     * @return mixed
-     */
-    public function getLen($activityId, $goodsId,$skuId)
-    {
-        $key = self::createListKey($activityId, $goodsId,$skuId);
-        return $this->cache->llen($key);
-    }
-
-    /**
-     * 删除key
-     * @param $activityId
-     * @param $goodsId
-     * @return mixed
-     */
-    public function delKey($activityId, $goodsId,$skuId)
-    {
-        $key = self::createListKey($activityId, $goodsId,$skuId);
-        return $this->cache->del($key);
-    }
-
-    /**************************************秒杀商品总数量 end********************************************************/
-
-
-    /**************************************用户活动商品限购数量 start******************************************************/
-    /**
-     * 用户限购表
-     * @param $activityId
-     * @return string
-     */
-    public function createTableKey($activityId)
-    {
-        return $this->enterpriseId . '_' . $activityId . '_' . self::$userLimitTable;
-    }
-
-    /**
-     * 活动商品购买记录
-     * @param $activityId
-     * @param $goodsId
-     * @param $skuId
-     * @param $userCenterId
-     * @param int $number
-     * @return mixed
-     */
-    public function writeLimit($activityId, $goodsId, $skuId, $userCenterId, $number = 1)
-    {
-        $table = self::createTableKey($activityId);
-        return $this->cache->hset($table, $goodsId . '_' . $skuId . '_' . $userCenterId, $number);
-    }
-
-    /**
-     * 缓存活动数据
-     * @param $activityId
-     * @param $goodsId
-     * @param $value
-     * @return mixed
-     */
-    public function writeActivity($activityId, $value)
-    {
-        $table = self::createTableKey($activityId);
-        return $this->cache->hset($table, self::$activityDetails, json_encode($value));
-    }
-
-    /**
-     * 获取活动详情
-     * @param $activityId
-     * @return mixed
-     */
-    public function getActivity($activityId)
-    {
-        $table = self::createTableKey($activityId);
-        $result = $this->cache->hget($table, self::$activityDetails);
-        if (!empty($result)) {
-            $result = json_decode($result, true);
-        }
-        return $result;
-    }
-
-    /**
-     * 获取用户已购购数量
-     * @param $activityId
-     * @param $goodsId
-     * @param $skuId
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function getLimit($activityId, $goodsId, $skuId,$userCenterId)
-    {
-        $table = self::createTableKey($activityId);
-        return $this->cache->hget($table, $goodsId . '_' . $skuId . '_' . $userCenterId);
-    }
-}

+ 0 - 81
Cache/AllTableNameCache.Class.php

@@ -1,81 +0,0 @@
-<?php
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Factory;
-
-class AllTableNameCache
-{
-    /**
-     * 所有表名缓存
-     *
-     * @var
-     */
-    static $allTableName = 'all_tablename';
-
-    /**
-     * 判断所有表名缓存是否存在
-     *
-     * @param string $databaseName 库名
-     *
-     * @return bool
-     */
-    static function allTableNameCacheIsExists($databaseName){
-        $result = Factory::cache('default')->has(self::$allTableName.'::'.$databaseName);
-        return $result;
-    }
-
-    /**
-     * 缓存制定库下的所有表名
-     *
-     * @param string $dataBaseName      当前数据库库名
-     * @param array  $allTableNameData  当前库中所有表名数据
-     *
-     * @return null
-     */
-    static function allTableNameCache($databaseName, $allTableNameData)
-    {
-        if(empty($allTableNameData)){
-            return false;
-        }
-
-        $pipe =  Factory::cache('default')->multi();
-        foreach ($allTableNameData as $key => $value){
-            $writeCache = Factory::cache('default')->sadd(self::$allTableName.'::'.$databaseName, $value['TABLE_NAME']);
-        }
-        $pipe->exec();
-    }
-
-    /**
-     * 判断是否存在这张表
-     *
-     * @param string $dataBaseName    当前数据库库名
-     * @param string $tableName       表名
-     *
-     * @return bool
-     */
-    static function TableIsExists($databaseName, $tableName)
-    {
-        $result =  Factory::cache('default')->sismember(self::$allTableName.'::'.$databaseName, $tableName);
-        return $result;
-    }
-
-    /**
-     * 添加新表到表名缓存中
-     * @param string $dataBaseName    当前数据库库名
-     * @param string $tableName       表名
-     *
-     * @return bool
-     */
-    static function addNewTableName($databaseName, $tableName){
-        $writeCache = Factory::cache('default')->sadd(self::$allTableName.'::'.$databaseName, $tableName);
-        return $writeCache;
-    }
-
-    /**
-     * 获取指定库下所有表
-     */
-    static function getAllTableNameByDatabaseName($databaseName)
-    {
-        return Factory::cache('default')->smembers(self::$allTableName.'::'.$databaseName);
-    }
-}

+ 0 - 132
Cache/CacheMan.Class.php

@@ -1,132 +0,0 @@
-<?php
-/**
- * 通用cache添加
- * Created by PhpStorm.
- * User: 小威
- * Date: 2019/12/13
- * Time: 17:00
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class CacheMan
-{
-    private $cache;
-
-    private $enterpriseId;
-
-    private $userCenterId;
-
-    private static $cacheKey = '';
-
-
-    public function __construct($enterpriseId, $userCenterId = false)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->userCenterId = $userCenterId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**---------------------------------------------哈希hash------------------------------------------------**/
-
-    /**
-     * 添加
-     * @param $key
-     * @param $value
-     * @param $cacheKey
-     * @return ResultWrapper
-     */
-    public function addCacheHash($key,$value, $cacheKey)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset($cacheKey . '::' . $this->enterpriseId, $key, $data);
-        if (!$result) {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-        return ResultWrapper::success('success');
-    }
-
-    /**
-     * 查询
-     * @param $key
-     * @param $cacheKey
-     * @param bool $type
-     * @return mixed|string
-     */
-    public function getCacheHash($key, $cacheKey, $type = false)
-    {
-        $result = $this->cache->hget($cacheKey.'::'.$this->enterpriseId, $key);
-        if (!$result) return '';
-        $returnData = json_decode($result, true);
-        if($type){
-            return $returnData[$type];
-        }
-        return $returnData;
-    }
-
-    /**
-     * 删除
-     * @param $key
-     * @param $cacheKey
-     */
-    public function delCacheHash($key, $cacheKey)
-    {
-        $this->cache->hdel($cacheKey.'::'.$this->enterpriseId, $key);
-    }
-
-    /***********************************************有序集合sorted set************************************************/
-    /**
-     * 添加
-     * @param $value $缓存的字段名 value
-     * @param $score $缓存的值 score
-     * @param $cacheKey
-     * @return mixed
-     */
-    public function createCacheStatistics($value,$score,$cacheKey)
-    {
-        $result = $this->cache->zadd($cacheKey.'::'.$this->enterpriseId, $score, $value);
-        if ($result == false){
-            return false;
-        }
-        return $result;
-    }
-
-
-    /**
-     * 获取
-     * @param $value $字段名 value
-     * @param $cacheKey
-     * @return mixed
-     */
-    public function getCacheSortedSet($value,$cacheKey)
-    {
-        $result = $this->cache->ZSCORE($cacheKey.'::'.$this->enterpriseId,$value);
-        return $result;
-    }
-
-    /**
-     * 获取key的个数
-     * @param $cacheKey
-     * @return mixed
-     */
-    public function getCacheKeySortedSetCount($cacheKey)
-    {
-        $result = $this->cache->ZCARD($cacheKey.'::'.$this->enterpriseId);
-        return $result;
-    }
-
-    /**
-     * 删除
-     * @param $cacheKey
-     * @return mixed
-     */
-    public function deleteCacheKey($cacheKey)
-    {
-        $result = $this->cache->del($cacheKey.'::'.$this->enterpriseId);
-        return $result;
-    }
-}

+ 0 - 76
Cache/CartCache.Class.php

@@ -1,76 +0,0 @@
-<?php
-/**
- * 购物车缓存
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/7
- * Time: 15:16
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Factory;
-
-class CartCache
-{
-    private $cache;
-
-    private $enterpriseId; //当前企业id
-
-    private static $cartTable;//缓存购物车
-
-    /**
-     * CartCache constructor.
-     * @param string $cacheDb
-     * @param $enterpriseId
-     * @throws \Exception
-     */
-    public function __construct($enterpriseId, $cacheDb = 'mapping')
-    {
-        $this->enterpriseId = $enterpriseId;
-        self::$cartTable = 'cartTable' . '::' . $this->enterpriseId;
-        $this->cache = Factory::cache($cacheDb);
-    }
-
-    /**
-     * 购物车数据缓存
-     * @param $params
-     * @param $userId
-     * @return mixed
-     */
-    public function cacheCartTable($params, $userId)
-    {
-        //$data = gzcompress(json_encode($params));
-        $data = json_encode($params);//测试时用这个
-        $result = $this->cache->hset(self::$cartTable, $userId, $data);
-        return $result;
-    }
-
-    /**
-     * 获取用户购物车数据
-     * @param $userId
-     * @return array|mixed
-     */
-    public function getCart($userId)
-    {
-        $result = $this->cache->hget(self::$cartTable,$userId);
-        if (!$result) {
-            return [];
-        }
-        if (!empty($result)){
-            $result = json_decode($result, true);
-        }
-        return $result;
-    }
-
-    /**
-     * 清空用户购物车
-     * @param $userId
-     * @return mixed
-     */
-    public function clearCart($userId)
-    {
-        $result = $this->cache->hdel(self::$cartTable,$userId);
-        return $result;
-    }
-}

+ 0 - 52
Cache/CollectCache.Class.php

@@ -1,52 +0,0 @@
-<?php
-/**
- * 收藏缓存
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/5
- * Time: 10:14
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Factory;
-
-class CollectCache
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-    protected $CollectKey = 'Collect';
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('user');
-    }
-
-    /**
-     * 缓存收藏
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $goodsId
-     * @return
-     */
-    public function cacheCollect($enterpriseId, $userCenterId, $goodsId)
-    {
-        $this->cache->sadd($this->CollectKey.'::'.$enterpriseId.'::'.$userCenterId, $goodsId);
-    }
-
-    public function getCollect($enterpriseId, $userCenterId, $goodsId) {
-        return $this->cache->sismember($this->CollectKey.'::'.$enterpriseId.'::'.$userCenterId, $goodsId);
-    }
-
-    public function delCollect($enterpriseId, $userCenterId, $goodsId) {
-        return $this->cache->srem($this->CollectKey.'::'.$enterpriseId.'::'.$userCenterId, $goodsId);
-    }
-
-    public function getCollectList($enterpriseId,$userCenterId)
-    {
-        return $this->cache->smembers($this->CollectKey.'::'.$enterpriseId.'::'.$userCenterId);
-    }
-}

+ 0 - 206
Cache/CommissionCache.Class.php

@@ -1,206 +0,0 @@
-<?php
-/**
- * 分销商cache
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Cache;
-
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Factory;
-
-class CommissionCache
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    private $enterpriseId;
-
-    private $userCenterId;
-
-    private static $settingCacheKey = 'CommissionSetting';
-
-    private static $businessmanGradeCacheKey = 'BusinessmanGrade';
-
-    private static $businessmanStatisticsCacheKey = 'BusinessmanStatistics';
-
-    private static $businessmanSubCacheKey = 'BusinessmanSub';
-
-
-    public function __construct($enterpriseId, $userCenterId = false)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->userCenterId = $userCenterId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**---------------------------------------------分销设置------------------------------------------------**/
-
-    /**
-     * 保存设置
-     * @param $value
-     * @return bool
-     */
-    public function saveSetting($value)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset(self::$settingCacheKey, $this->enterpriseId, $data);
-        if (!$result) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 查询设置
-     * @param bool $field
-     * @return mixed|string
-     */
-    public function getSetting($field = false)
-    {
-        $result = $this->cache->hget(self::$settingCacheKey, $this->enterpriseId);
-        if (!$result) return [];
-        $returnData = json_decode($result, true);
-        if($field){
-            return $returnData[$field];
-        }
-        return $returnData;
-    }
-
-    /**
-     * 删除
-     */
-    public function delSetting()
-    {
-        $this->cache->hdel(self::$settingCacheKey, $this->enterpriseId);
-    }
-
-    /*********************************************** 分销商等级 ************************************************/
-    /**
-     * 添加
-     * @param $userCenterId
-     * @param $value $缓存的字段
-     * @return mixed
-     */
-    public function saveBusinessmanGrade($userCenterId, $value)
-    {
-        $data = json_encode($value);
-        return $this->cache->hset(self::$businessmanGradeCacheKey."::".$this->enterpriseId, $userCenterId, $data);
-    }
-
-
-    /**
-     * 查询
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function getBusinessmanGrade($userCenterId)
-    {
-        $result = $this->cache->hget(self::$businessmanGradeCacheKey."::".$this->enterpriseId, $userCenterId);
-        if (!$result) return [];
-        return json_decode($result, true);
-    }
-
-
-    /**
-     * 删除
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function delBusinessmanGrade($userCenterId)
-    {
-        if($userCenterId === true){
-            return $this->cache->del(self::$businessmanGradeCacheKey."::".$this->enterpriseId);
-        }
-        return $this->cache->hdel(self::$businessmanGradeCacheKey."::".$this->enterpriseId, $userCenterId);
-    }
-
-    /********************************************分销商升级条件统计*********************************************/
-    /**
-     * 保存
-     * @param $userCenterId
-     * @param $value
-     * @return bool
-     */
-    public function saveBusinessmanStatistics($userCenterId, $value)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset(self::$businessmanStatisticsCacheKey."::".$this->enterpriseId, $userCenterId, $data);
-        if (!$result) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 查询
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function getBusinessmanStatistics($userCenterId)
-    {
-        $result = $this->cache->hget(self::$businessmanStatisticsCacheKey."::".$this->enterpriseId, $userCenterId);
-        if (!$result) return [];
-        return json_decode($result, true);
-    }
-
-
-    /**
-     * 删除
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function delBusinessmanStatistics($userCenterId)
-    {
-        if($userCenterId === true){
-            return $this->cache->del(self::$businessmanStatisticsCacheKey."::".$this->enterpriseId);
-        }
-        return $this->cache->hdel(self::$businessmanStatisticsCacheKey."::".$this->enterpriseId, $userCenterId);
-    }
-
-    /********************************************分销商下级人数统计*********************************************/
-    /**
-     * 保存
-     * @param $userCenterId
-     * @param $value
-     * @return bool
-     */
-    public function saveBusinessmanSub($userCenterId, $value)
-    {
-        $data = json_encode($value);
-        return $this->cache->hset(self::$businessmanSubCacheKey."::".$this->enterpriseId, $userCenterId, $data);
-    }
-
-    /**
-     * 查询
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function getBusinessmanSub($userCenterId)
-    {
-        $result = $this->cache->hget(self::$businessmanSubCacheKey."::".$this->enterpriseId, $userCenterId);
-        if (!$result) return [];
-        return json_decode($result, true);
-    }
-
-
-    /**
-     * 删除
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function delBusinessmanSub($userCenterId)
-    {
-        if($userCenterId === true){
-            return $this->cache->del(self::$businessmanSubCacheKey."::".$this->enterpriseId);
-        }
-        return $this->cache->hdel(self::$businessmanSubCacheKey."::".$this->enterpriseId, $userCenterId);
-    }
-
-}

+ 0 - 300
Cache/CustomerCache.Class.php

@@ -1,300 +0,0 @@
-<?php
-/**
- * 客户统计部分埋点
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/14
- * Time: 11:58
- */
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class CustomerCache {
-
-    /**
-     * @var Redis
-     */
-    private $cache;
-    protected $key = '';
-    protected $registerSmsCountKey = 'todayCreateOrderCustomer::'; //今日下单用户key
-    protected $customerExpire = 10;//过期时间为一天
-    protected $allCustomerNumKey = 'allCustomerNum';//全部客户数量key
-    protected $lastMonthNewCustomerKey = 'lastMonthNewCustomer';//新增客户数量:最近30天新增,且没有成功付款的客户 key
-    protected $interestCustomerKey = 'interestCustomer';//兴趣人群数量:近7天有加购行为,但没有成功付款的客户
-    protected $customerDataKey = 'customerInfoCache'; // 客户信息数据缓存
-    protected $customerDataByUserCenterIdKey ='customerDataByUserCenterId';//指定用户信息缓存
-
-    public function __construct()
-    {
-        $this->key = $this->registerSmsCountKey . date('Ymd', time());
-        $this->cache = Factory::cache('user');
-    }
-
-    /***************************** 今日下单用户相关 start **********************************/
-
-    /**
-     * 下单时调用此方法,添加一条客户下单信息  todayCreateOrderCustomer::20190101:0001:0002:0003
-     * @param $enterpriseId
-     * @param $provinceCode
-     * @param $cityCode
-     * @param $districtCode
-     * @param $customerId
-     * @param $shopId
-     * @return bool|ResultWrapper
-     */
-    public function cacheCustomerOrderInfo($enterpriseId, $provinceCode = null, $cityCode = null, $districtCode = null, $customerId, $shopId = null) {
-        if (empty($enterpriseId) || empty($customerId)) {
-            return false;
-        }
-        $this->key = $this->key.'::enterprise_'.$enterpriseId;
-        $this->cache->zincrby($this->key, 1, $customerId);//存全国
-        $this->cache->expire($this->key, $this->customerExpire);
-
-        if(!empty($provinceCode)) {
-            $key = $this->key . '::areaCode_'.$provinceCode;
-            $this->cache->zincrby($key, 1, $customerId);//存省
-            $this->cache->expire($key, $this->customerExpire);
-        }
-
-        if(!empty($cityCode)) {
-            $key = $this->key . '::areaCode_'.$cityCode;
-            $this->cache->zincrby($key, 1, $customerId);//存市
-            $this->cache->expire($key, $this->customerExpire);
-        }
-
-        if(!empty($districtCode)) {
-            $key = $this->key . '::areaCode_'.$districtCode;
-            $this->cache->zincrby($key, 1, $customerId);//存区
-            $this->cache->expire($key, $this->customerExpire);
-        }
-
-        if(!empty($shopId)) {
-            $key = $this->key . '::shopId_'.$shopId;
-            $this->cache->zincrby($key, 1, $customerId);
-            $this->cache->expire($key, $this->customerExpire);
-        }
-        return true;
-    }
-
-    /**
-     * 今日下单用户统计,按地区搜索
-     * @param $enterpriseId 企业id
-     * code不传则查的是全国的客户下单信息
-     * @param $code
-     * @param $shopId
-     * @return array
-     */
-    public function getTodayCustomerOrderInfo($enterpriseId, $code = null, $shopId = null) {
-        $key = $this->key.'::enterprise_'.$enterpriseId;
-        if(!empty($code)) {
-            $key .= '::areaCode_' . $code;
-        }
-        if(!empty($shopId)) {
-            $key .= '::shopId_' . $shopId;
-        }
-        $result = $this->cache->zrange($key, 0, -1);
-        return $result ? $result : [];
-    }
-
-    /***************************** 今日下单用户相关 end **********************************/
-
-    /***************************** 全部客户数量相关 start **********************************/
-
-    /**
-     * @param int $enterpriseId
-     * @param int $num
-     * @return bool
-     */
-    public function setCustomerNum(int $enterpriseId,int $num)
-    {
-        $result = $this->cache->set($this->allCustomerNumKey.'::'.$enterpriseId,$num);
-        return $result ? true : false;
-    }
-
-    /**
-     * 增加客户数量:每次客户审核通过调用此方法
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function incrCustomerNum($enterpriseId) {
-        $result = $this->cache->incr($this->allCustomerNumKey.'::'.$enterpriseId);
-        return $result ? true : false;
-    }
-
-    /**
-     * 获取当前客户总数
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function getAllCustomerNum($enterpriseId) {
-        return $this->cache->get($this->allCustomerNumKey.'::'.$enterpriseId);
-    }
-
-    /***************************** 全部客户数量相关 end **********************************/
-
-
-    /***************************** 新增客户数量相关 start **********************************/
-
-    /**
-     * 新增客户 customerId  score存时间戳   审核用户时调用此方法,近一个月注册的用户
-     * @param $customerId
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function incrCustomer($customerId, $enterpriseId) {
-        $result = $this->cache->zadd($this->lastMonthNewCustomerKey.'::'.$enterpriseId, time(), $customerId);
-        return $result ? true : false;
-    }
-
-    /**
-     * 获取新增客户数
-     * @param $enterpriseId
-     * @return int
-     */
-    public function getNewCustomerNum($enterpriseId) {
-        $result = $this->cache->zcard($this->lastMonthNewCustomerKey.'::'.$enterpriseId);
-        return $result ? $result : 0;
-    }
-    /**
-     * 删除所有企业注册超过30天的用户
-     * @return bool   true代表有数据被删除  false相反
-     */
-    public function delCustomerOfOneMonthAgo() {
-        //获取所有key  ['lastMonthNewCustomer::12','lastMonthNewCustomer::11']
-        $keysList = $this->cache->keys($this->lastMonthNewCustomerKey.'*');
-        $oneMonthAgoTimestamp = strtotime("-30 day");
-        foreach ($keysList as $value) {
-            $keyArr = explode('::', $value);
-            $result = $this->cache->zremrangebyscore($this->lastMonthNewCustomerKey.'::'.$keyArr[2], 0, $oneMonthAgoTimestamp);
-            if(!$result) {
-                return false;//没有数据可删除也返回false
-            }
-        }
-        return true;
-    }
-
-    /**
-     * 客户下单后删除客户信息
-     * @param $customerId
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function delCustomerAfterPlaceOrder($customerId, $enterpriseId) {
-        $result = $this->cache->zrem($this->lastMonthNewCustomerKey.'::'.$enterpriseId, $customerId);
-        return $result ? true : false;
-    }
-    /***************************** 新增客户数量相关 end **********************************/
-
-    /***************************** 兴趣人群数量 : 近7天加购行为 start **********************************/
-    /**
-     * 加入购物车 customerId  score存时间戳   注册用户时调用此方法
-     * @param $customerId
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function incrInterestCustomer($customerId, $enterpriseId) {
-        $result = $this->cache->zadd($this->interestCustomerKey.'::'.$enterpriseId, time(), $customerId);
-        return $result ? true : false;
-    }
-
-    /**
-     * 删除所有企业加购超过7天的用户
-     * @return bool   true代表有数据被删除  false相反
-     */
-    public function delInterestCustomerOfSevenDaysAgo() {
-        //获取所有key  ['lastMonthNewCustomer::12','lastMonthNewCustomer::11']
-        $keysList = $this->cache->keys($this->interestCustomerKey.'*');
-        $SeveralDaysAgoTimestamp = strtotime("-7 day");
-        foreach ($keysList as $value) {
-            $keyArr = explode('::', $value);
-            $result = $this->cache->zremrangebyscore($this->interestCustomerKey.'::'.$keyArr[2], 0, $SeveralDaysAgoTimestamp);
-            if(!$result) {
-                return false;//没有数据可删除也返回false
-            }
-        }
-        return true;
-    }
-
-
-    /**
-     * 获取兴趣人群数
-     * @param $enterpriseId
-     * @return int
-     */
-    public function getInterestCustomerNum($enterpriseId) {
-        $result = $this->cache->zcard($this->interestCustomerKey.'::'.$enterpriseId);
-        return $result ? $result : 0;
-    }
-
-
-    /**
-     * 客户成功付款后删除信息
-     * @param $customerId
-     * @param $enterpriseId
-     * @return bool
-     */
-    public function delInterestCustomerAfterPay($customerId, $enterpriseId) {
-        $result = $this->cache->zrem($this->interestCustomerKey.'::'.$enterpriseId, $customerId);
-        return $result ? true : false;
-    }
-
-    /***************************** 近7天加购行为 end **********************************/
-
-    /**
-     * 客户信息缓存
-     */
-    public function cacheCustomerData($enterpriseId, $customerId, $customerData)
-    {
-        return $this->cache->hset($this->customerDataKey.'::'.$enterpriseId, $customerId, json_encode($customerData));
-    }
-
-    /**
-     * 获取客户信息
-     */
-    public function getCustomerData($enterpriseId,$customerId)
-    {
-        $customerData = $this->cache->hget($this->customerDataKey.'::'.$enterpriseId, $customerId);
-        if( $customerData ){
-            return json_decode($customerData, true);
-        }
-    }
-
-    /**
-     * 删除客户缓存
-     */
-    public function delCustomerData($enterpriseId,$customerId)
-    {
-        return $this->cache->hdel($this->customerDataKey.'::'.$enterpriseId, $customerId);
-    }
-
-    /**
-     * 指定客户信息缓存
-     */
-    public function cacheCustomerUserData($enterpriseId, $userCenterId, $customerData)
-    {
-        return $this->cache->hset($this->customerDataByUserCenterIdKey.'::'.$enterpriseId, $userCenterId, json_encode($customerData));
-    }
-
-    /**
-     * 获取指定客户信息
-     */
-    public function getCustomerUserData($enterpriseId,$userCenterId)
-    {
-        $customerData = $this->cache->hget($this->customerDataByUserCenterIdKey.'::'.$enterpriseId, $userCenterId);
-        if( $customerData ){
-            return json_decode($customerData, true);
-        }
-    }
-
-    /**
-     * 删除指定客户缓存
-     */
-    public function delCustomerUserData($enterpriseId,$userCenterId)
-    {
-        return $this->cache->hdel($this->customerDataByUserCenterIdKey.'::'.$enterpriseId, $userCenterId);
-    }
-}

+ 0 - 182
Cache/EnterpriseCache.Class.php

@@ -1,182 +0,0 @@
-<?php
-namespace Jindouyun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class EnterpriseCache
-{
-    private $cache;
-    protected $UserRelationEnterpriseKey = 'userRelationEnterprise';//用户id和公司id关联缓存
-    protected $EnterpriseIdRelationTokenKey = 'enterpriseIdRelationTokenKey';
-    protected $StaffTotalKey = 'EnterpriseStaffTotal';//企业员工总数
-
-    protected $enterpriseSettingKey = 'EnterpriseSetting';//企业设置
-
-
-    // 企业相关配置信息数据
-    protected $enterpriseInfoData = 'enterpriseInfoData';
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('user');
-    }
-    /*******************  start:userCenterId与企业Id的关联   value:enterpriseId  score:roleType   **************/
-
-    /**
-     * 增:
-     * 缓存userCenterId和enterpriseId关系数据
-     * @param $uid int 用户id
-     * @param $roleType int 角色
-     * @param $enterpriseId  企业id
-     * @return
-     */
-    public function cacheUserCenterIdAndEnterpriseId($uid, $roleType, $enterpriseId)
-    {
-        $this->cache->zadd($this->UserRelationEnterpriseKey.'::'.$uid, $roleType, $enterpriseId);
-    }
-
-    /**
-     * 查:
-     * 获取用户和企业的关联关系数组
-     *
-     * @param $userCenterId
-     * @param int $enterpriseId 公司ID
-     *
-     * @return boolean
-     */
-    public function getUserCenterIdAndEnterpriseIds($userCenterId)
-    {
-        $result =  $this->cache->zrangebyscore($this->UserRelationEnterpriseKey.'::'.$userCenterId, 1,2, array('withscores' => TRUE));
-        return $result;
-    }
-
-    /**
-     * 删:
-     * 删除userCenterId和企业id的绑定关系
-     * @param $userCenterId
-     * @param int $enterpriseId 被删除的企业id
-     */
-    public function deleteEnterprise($userCenterId, $enterpriseId)
-    {
-        $this->cache->zrem($this->UserRelationEnterpriseKey.'::'.$userCenterId , $enterpriseId);
-    }
-    /*******************  end:userCenterId与企业Id的关联   value:enterpriseId  score:roleType   **************/
-
-
-    /*******************  start:企业token与企业id的关联   value:Token  score:enterpriseId   **************/
-
-    /**
-     * 缓存 企业id 和 token 关联关系
-     * @param $enterpriseId
-     * @param $token
-     * @return ResultWrapper
-     */
-    public function enterpriseIdAndTokenCache($enterpriseId, $token)
-    {
-        return $this->cache->zadd($this->EnterpriseIdRelationTokenKey, $enterpriseId, $token);
-    }
-
-    /**
-     * 根据token获取企业id  反解token需要
-     * @param $token
-     * @return
-     */
-    public function getEnterpriseIdByToken($token)
-    {
-        return $this->cache->zscore($this->EnterpriseIdRelationTokenKey, $token);
-    }
-
-    /*******************  end:企业token与企业id的关联   value:Token  score:enterpriseId   **************/
-
-    /**
-     * 缓存企业数据
-     */
-    public function EnterpriseDataCache($enterpriseId, $field, $value)
-    {
-        return $this->cache->hset($enterpriseId, $field, $value);
-    }
-
-    /**
-     * 获取企业数据
-     */
-    public function getEnterpriseData($enterpriseId, $field)
-    {
-        return $this->cache->hget($enterpriseId, $field);
-    }
-
-    /******************************** 缓存企业下员工总数(未删除) **************************/
-    public function setStaffTotalByEnterpriseId($enterpriseId, $total)
-    {
-        $result = $this->cache->zadd($this->StaffTotalKey, $total, $enterpriseId);
-        return $result;
-    }
-    public function getStaffTotalByEnterpriseId($enterpriseId)
-    {
-        $result = $this->cache->zscore($this->StaffTotalKey, $enterpriseId);
-        return $result;
-    }
-    public function delStaffTotalByEnterpriseId($enterpriseId)
-    {
-        $result = $this->cache->del($this->StaffTotalKey, $enterpriseId);
-        return $result;
-    }
-    /******************************** 缓存企业下商铺总数(未删除) **************************/
-    public function setShopTotalByEnterpriseId($enterpriseId, $total)
-    {
-        $result = $this->cache->zadd($this->StaffTotalKey, $total, $enterpriseId);
-        return $result;
-    }
-    public function getShopTotalByEnterpriseId($enterpriseId)
-    {
-        $result = $this->cache->zscore($this->StaffTotalKey, $enterpriseId);
-        return $result;
-    }
-    public function delShopTotalByEnterpriseId($enterpriseId)
-    {
-        $result = $this->cache->del($this->StaffTotalKey, $enterpriseId);
-        return $result;
-    }
-
-    /******************************* 缓存企业设置数据 ************************************/
-    /**
-     * 添加企业设置
-     * @param $key
-     * @param $value
-     * @return bool
-     */
-    public function setEnterpriseSetting($key,$value)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset($this->enterpriseSettingKey, $key, $data);
-        if (!$result) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 获取企业设置
-     * @param $key
-     * @return array|mixed
-     */
-    public function getEnterpriseSetting($key)
-    {
-        $result = $this->cache->hget($this->enterpriseSettingKey, $key);
-        if (!$result) return [];
-        return json_decode($result, true);
-    }
-
-    /**
-     * 删除企业设置
-     * @param $key
-     * @return mixed
-     */
-    public function delEnterpriseSetting($key)
-    {
-        return $this->cache->hdel($this->enterpriseSettingKey, $key);
-    }
-
-}

+ 0 - 202
Cache/FinanceCache.Class.php

@@ -1,202 +0,0 @@
-<?php
-/**
- * 首付款暂存
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/5
- * Time: 10:14
- */
-
-namespace JinDouYun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class FinanceCache
-{
-    private $cache;
-    protected $receivedReceiptTemporarySaveKey = 'receivedReceiptTemporarySave';//收款单暂存
-    protected $paidReceiptTemporarySaveKey = 'paidReceiptTemporarySave';//付款单暂存
-    protected $accountTransferTemporarySaveKey = 'accountTransferTemporarySave';//资金转账单暂存
-    protected $salesOutReceiveKey = 'salesOutReceive';//销售出库生成应收,缓存应收单的id
-    private $existPayEnterpriseKey = 'existPayEnterprise'; // 存在应付单的企业标识
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('finance');
-    }
-
-    /**
-     * 收款单暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveReceivedReceipt($enterpriseId, $userCenterId, $data)
-    {
-        if( empty($data) ){
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->receivedReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取客户的收款单暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getReceivedReceipt($enterpriseId, $userCenterId)
-    {
-        $receivedData = $this->cache->hget($this->receivedReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-        return $receivedData ? json_decode($receivedData,true) : [];
-    }
-
-    /**
-     * 删除客户的收款单暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delReceivedReceipt($enterpriseId,$userCenterId)
-    {
-        $result =  $this->cache->hdel($this->receivedReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-    }
-
-
-    /**
-     * 付款单暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function savePaidReceipt($enterpriseId, $userCenterId, $data)
-    {
-        if( empty($data) ){
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->paidReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取客户的付款单暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getPaidReceipt($enterpriseId, $userCenterId)
-    {
-        $paidData = $this->cache->hget($this->paidReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-        return $paidData ? json_decode($paidData,true) : [];
-    }
-
-    /**
-     * 删除客户的付款单暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delPaidReceipt($enterpriseId,$userCenterId)
-    {
-        $result =  $this->cache->hdel($this->paidReceiptTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 资金转账单暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveAccountTransfer($enterpriseId, $userCenterId, $data)
-    {
-        if( empty($data) ){
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->accountTransferTemporarySaveKey.'::'.$enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取资金转账单暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getAccountTransfer($enterpriseId, $userCenterId)
-    {
-        $data = $this->cache->hget($this->accountTransferTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-        return $data ? json_decode($data,true) : [];
-    }
-
-    /**
-     * 删除资金转账单 暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delAccountTransfer($enterpriseId,$userCenterId)
-    {
-        $result =  $this->cache->hdel($this->accountTransferTemporarySaveKey.'::'.$enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 销售出库生成应收单,应收单自动审核  缓存应收单id和时间
-     * @param $enterpriseId
-     * @param $id
-     * @param $createTime
-     * @return array|mixed
-     */
-    public function saveSalesOutReceive($enterpriseId, $id, $createTime)
-    {
-        $this->cache->zadd($this->salesOutReceiveKey.'::'.$enterpriseId, $createTime, $id);
-    }
-
-    public function delSalesOutReceive($enterpriseId, $id)
-    {
-        $this->cache->zrem($this->salesOutReceiveKey.'::'.$enterpriseId, $id);
-    }
-
-    public function getAllSalesOutReceive() {
-        $data = [];
-        $keysList = $this->cache->keys($this->salesOutReceiveKey.'*');
-        foreach ($keysList as $value) {
-            $keyArr = explode('::', $value);
-            $result = $this->cache->zrangebyscore($this->salesOutReceiveKey.'::'.$keyArr[2], 0,  time(),array('withscores' => TRUE));
-            if($result) {
-                foreach ($result as $k => $v) {
-                    $data[$keyArr[2]][] = [
-                        'id'=> $k,
-                        'createTime'=>(int)$v
-                    ];
-                }
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * 缓存一下那个企业有应付单生成,便于计划任务进行自动切换企业,做自动审核
-     */
-    public function cacheExistPayEnterprise($enterpriseId)
-    {
-        return $this->cache->sadd($this->existPayEnterpriseKey, $enterpriseId);
-    }
-
-    /**
-     * 获取一下有应付单的企业数据
-     * @return array|boolean
-     */
-    public function getExistPayEnterprise()
-    {
-        return $this->cache->smembers($this->existPayEnterpriseKey);
-    }
-
-    /**
-     * 把企业从缓存中删除
-     */
-    public function delExistPayEnterprise($enterpriseId)
-    {
-        return $this->cache->srem($this->existPayEnterpriseKey, $enterpriseId);
-    }
-}

+ 0 - 132
Cache/GoodsBasicCache.Class.php

@@ -1,132 +0,0 @@
-<?php
-/**
- * 缓存基础商品数据
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/25
- * Time: 12:05
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-/**
- * todo(这个类中有很多没用的缓存,之后清理)
- * Class GoodsBasicCache
- * @package JinDouYun\Cache
- */
-class GoodsBasicCache
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    private $onlineEnterpriseId;
-
-    protected $categoryKey = 'categoryAndBasicNum';
-
-    protected $brandKey = 'brandAndBasicNum';
-
-    /**
-     * GoodsBasicCache constructor.
-     * @param $enterpriseId
-     * @throws \Exception
-     */
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('default');
-    }
-
-    /**
-     * @param $categoryId
-     * @param $num
-     * @return ResultWrapper
-     */
-    public function cacheCategoryRelationGoodsBasicNum($categoryId, $num)
-    {
-        $result = $this->cache->zadd($this->categoryKey.'::'.$this->onlineEnterpriseId, $num, $categoryId);
-        return $result;
-    }
-
-    /**
-     * @param $categoryId
-     * @return mixed
-     */
-    public function categoryKeyScoreIncr($categoryId)
-    {
-        $result = $this->cache->zincrby($this->categoryKey.'::'.$this->onlineEnterpriseId, 1, $categoryId);
-        return $result;
-    }
-
-    /**
-     * @param $categoryId
-     * @return mixed
-     */
-    public function categoryKeyScoreDecr($categoryId)
-    {
-        $result = $this->cache->zincrby($this->categoryKey.'::'.$this->onlineEnterpriseId, -1, $categoryId);
-        return $result;
-    }
-
-    /**
-     * @param $categoryId
-     * @return int
-     */
-    public function getCategoryGoodsBasicNum($categoryId)
-    {
-        $result = $this->cache->zscore($this->categoryKey.'::'.$this->onlineEnterpriseId, $categoryId);
-        return $result;
-    }
-
-    /**********************************************brand start*****************************************************************/
-
-    /**
-     * @param $brandId
-     * @param $num
-     * @return mixed
-     */
-    public function cacheBrandRelationGoodsBasicNum($brandId,$num)
-    {
-        $result = $this->cache->zadd($this->brandKey.'::'.$this->onlineEnterpriseId, $num, $brandId);
-        if ($result == false){
-            return 0;
-        }
-        return $result;
-    }
-
-
-    /**
-     * @param $brandId
-     * @return mixed
-     */
-    public function brandKeyScoreIncr($brandId)
-    {
-        $result = $this->cache->zincrby($this->brandKey.'::'.$this->onlineEnterpriseId, 1, $brandId);
-        return $result;
-    }
-
-    /**
-     * @param $brandId
-     * @return mixed
-     */
-    public function brandKeyScoreDecr($brandId)
-    {
-        $result = $this->cache->zincrby($this->brandKey.'::'.$this->onlineEnterpriseId, -1, $brandId);
-        return $result;
-    }
-
-    /**
-     * @param $brandId
-     * @return mixed
-     */
-    public function getBrandGoodsBasicNum($brandId)
-    {
-        $result = $this->cache->zscore($this->brandKey.'::'.$this->onlineEnterpriseId, $brandId);
-        return $result;
-    }
-}

+ 0 - 330
Cache/GoodsBasicRelevant.Class.php

@@ -1,330 +0,0 @@
-<?php
-/**
- * (品牌,分类,sku 信息映射)
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/28
- * Time: 11:46
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-use think\Exception;
-
-class GoodsBasicRelevant
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    private $onlineEnterpriseId;
-
-    private static $categoryKey = 'categoryIdRelationName';
-
-    private static $brandKey = 'brandIdRelationName';
-
-    private static $skuKey = 'skuIdRelationNameHash';
-
-    private static $basicKey = 'basicIdRelationName';
-
-    private static $skuField = 'skuId';
-
-    private static $warehouseIdKey = 'WarehouseIdRelationName';
-
-    private static $ShopIdKey = 'ShopIdRelationName';
-
-
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /******************************************category start****************************************************************/
-
-    /**
-     * 缓存 name => id
-     * @param $name
-     * @param $categoryId
-     * @return mixed
-     */
-    public function cacheCategoryIdRelationName($name, $categoryId)
-    {
-        $result = $this->cache->zadd(self::$categoryKey . '::' . $this->onlineEnterpriseId, $categoryId, $name);
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 通过id获取集合中的name
-     * @param $categoryId
-     * @return array|string
-     */
-    public function getNameByCategoryId($categoryId)
-    {
-        $result = $this->cache->zrangebyscore(self::$categoryKey . '::' . $this->onlineEnterpriseId, $categoryId, $categoryId);
-        if (!$result) {
-            return '';
-        }
-        if (is_array($result)){
-            return  empty($result) ? '' : array_shift($result);
-        }
-        return $result;
-    }
-
-    /**
-     * 返回成员member的score值
-     */
-    public function getCategoryIdByName($name)
-    {
-        $result = $this->cache->zscore(self::$categoryKey . '::' . $this->onlineEnterpriseId, $name);
-        if (!$result) {
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * 移除指定元素
-     * @param $categoryId
-     * @return mixed
-     */
-    public function deleteCategoryKeyById($categoryId)
-    {
-        $result = $this->cache->zremrangebyscore(self::$categoryKey . '::' . $this->onlineEnterpriseId, $categoryId, $categoryId);
-        return $result;
-    }
-
-    /************************************************brand start**********************************************************/
-
-    /**
-     * 缓存 name => id
-     * @param $name
-     * @param $brandId
-     * @return mixed
-     */
-    public function cacheBrandIdRelationName($name, $brandId)
-    {
-        $result = $this->cache->zadd(self::$brandKey . '::' . $this->onlineEnterpriseId, $brandId, $name);
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 通过id获取集合中的name
-     * @param $brandId
-     * @return string|array
-     */
-    public function getNameByBrandId($brandId)
-    {
-        $result = $this->cache->zrangebyscore(self::$brandKey . '::' . $this->onlineEnterpriseId, $brandId, $brandId);
-        if (!$result) {
-            return '';
-        }
-        if (is_array($result)){
-            return empty($result) ? '' : array_shift($result);
-        }
-        return $result;
-    }
-
-    /**
-     * 移除指定元素
-     * @param $brandId
-     * @return mixed
-     */
-    public function deleteBrandKeyById($brandId)
-    {
-        $result = $this->cache->zremrangebyscore(self::$brandKey . '::' . $this->onlineEnterpriseId, $brandId, $brandId);
-        return $result;
-    }
-
-    /********************************************sku start**************************************************************/
-    /**
-     * sku缓存数据
-     * @param $name
-     * @param $skuId
-     * @return mixed
-     */
-    public function cacheSkuIdRelationName($name, $skuId)
-    {
-        $result = $this->cache->hset(self::$skuKey.'::'.$this->onlineEnterpriseId,self::$skuField.'::'.$skuId,$name);
-        return $result;
-    }
-
-    /**
-     * 根据skuId获取名称
-     * @param $skuId
-     * @return mixed
-     */
-    public function getNameBySkuId($skuId)
-    {
-        $result = $this->cache->hget(self::$skuKey.'::'.$this->onlineEnterpriseId,self::$skuField.'::'.$skuId);
-        if (!$result){
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * 移除指定元素
-     * @param $skuId
-     * @return mixed
-     */
-    public function deleteSkuKeyById($skuId)
-    {
-        $result = $this->cache->zremrangebyscore(self::$skuKey . '::' . $this->onlineEnterpriseId, $skuId, $skuId);
-        return $result;
-    }
-
-    /***********************************************basic start*********************************************************/
-    /**
-     * Model/Goods/BasicAndSkuCache 中调用了
-     * todo(方法名称不符合规范。。。。。。。。。。)
-     * mapping
-     * 缓存 data => id
-     * @param $data
-     * @param $basicId
-     * @return ResultWrapper
-     */
-    public function cacheBasicIdRelationName(array $data,int $basicId)
-    {
-        $data = gzcompress(serialize($data));
-        $result = $this->cache->hset(self::$basicKey . '::' . $this->onlineEnterpriseId, $basicId, $data);
-        if ($result) {
-            return ResultWrapper::success('添加缓存成功');
-        } else {
-            return ResultWrapper::fail('添加缓存失败', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * $fields
-     * true : 返回所有字段信息(array)
-     * field : 返回对应字段值 (string)
-     *
-     * todo(方法名称不符合规范。。。。。。。。。。)
-     * 根据商品id,获取商品信息
-     * @param $basicId
-     * @param string $fields
-     * @return array|string
-     */
-    public function getNameByBasicId(int $basicId, $fields = 'title')
-    {
-        $result = $this->cache->hget(self::$basicKey . '::' . $this->onlineEnterpriseId, $basicId);
-        if (!$result) {
-            if($fields === true || $fields == 'images') return [];
-            return '';
-        }
-        $result = unserialize(zlib_decode($result));
-        $result['images'] = is_array($result['images']) ? $result['images'] : json_decode($result['images'], true);
-        $result['extends'] = empty($result['extends']) ? [] : json_decode($result['extends'],true);
-        if($fields === true) return $result;
-        if (isset($result[$fields])){
-            return $result[$fields];
-        }
-        return '';
-    }
-
-    /**
-     * @param $basicId
-     * @return mixed
-     */
-    public function deleteBasicKeyById(int $basicId)
-    {
-        return $this->cache->hdel(self::$basicKey . '::' . $this->onlineEnterpriseId, $basicId);
-    }
-
-    /***************************************仓库数据 缓存
-     * 增加
-     * @param $warehouseId
-     * @param $warehouseData
-     * @return ResultWrapper
-     */
-    public function cacheWarehouseIdRelationName($warehouseId,$warehouseData)
-    {
-        $data = json_encode($warehouseData);
-        $result = $this->cache->hset(self::$warehouseIdKey . '::' . $this->onlineEnterpriseId, $warehouseId, $data);
-        if (!$result) {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-        return ResultWrapper::success('success');
-    }
-
-    /**
-     * 查询
-     * @param $warehouseId
-     * @param bool $type
-     * @return mixed|string
-     */
-    public function getNameByWarehouseId($warehouseId, $type = false)
-    {
-        $result = $this->cache->hget(self::$warehouseIdKey.'::'.$this->onlineEnterpriseId, $warehouseId);
-        if (!$result) return '';
-        if($type){
-            return json_decode($result, true);
-        }
-        return json_decode($result, true)['warehouseName'];
-    }
-
-    /**
-     * 删除
-     * @param $warehouseId
-     */
-    public function delNameByWarehouseId($warehouseId)
-    {
-        $this->cache->hdel(self::$warehouseIdKey.'::'.$this->onlineEnterpriseId, $warehouseId);
-    }
-
-    /***************************************商铺
-     *
-     * 添加
-     * @param $ShopId
-     * @param $warehouseData
-     * @return ResultWrapper
-     */
-    public function cacheShopIdRelationName($ShopId,$warehouseData)
-    {
-        $data = json_encode($warehouseData);
-        $result = $this->cache->hset(self::$ShopIdKey . '::' . $this->onlineEnterpriseId, $ShopId, $data);
-        if (!$result) {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-        return ResultWrapper::success('success');
-    }
-
-    /**
-     * 查询
-     * @param $ShopId
-     * @param bool $type
-     * @return mixed|string
-     */
-    public function getNameByShopId($ShopId, $type = false)
-    {
-        $result = $this->cache->hget(self::$ShopIdKey.'::'.$this->onlineEnterpriseId, $ShopId);
-        if (!$result) return '';
-        if($type){
-            return json_decode($result, true);
-        }
-        return json_decode($result, true)['name'];
-    }
-
-    /**
-     * 删除
-     * @param $ShopId
-     */
-    public function delNameByShopId($ShopId)
-    {
-        $this->cache->hdel(self::$ShopIdKey.'::'.$this->onlineEnterpriseId, $ShopId);
-    }
-}

+ 0 - 118
Cache/InventoryCache.Class.php

@@ -1,118 +0,0 @@
-<?php
-/**
- * 库存cache添加
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/01/11
- * Time: 16:00
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class InventoryCache
-{
-    private $cache;
-
-    private $enterpriseId;
-
-    private $userCenterId;
-
-    private $cacheKey = 'Inventory';
-
-    private $cacheKeyShopLock = 'InventoryLock';
-
-
-    public function __construct($enterpriseId, $userCenterId = false)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->userCenterId = $userCenterId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**---------------------------------------------仓库库存------------------------------------------------**/
-
-    /**
-     * 添加
-     * @param $key
-     * @param $value
-     * @return ResultWrapper
-     */
-    public function addCacheHash($key,$value)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset($this->cacheKey . '::' . $this->enterpriseId.'::'.$value['warehouseId'], $key, $data);
-        if (!$result) {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-        return ResultWrapper::success('success');
-    }
-
-    /**
-     * 查询
-     * @param $skuId
-     * @param $warehouseId
-     * @param bool $type
-     * @return mixed|string
-     */
-    public function getCacheHash($skuId, $warehouseId, $type = false)
-    {
-        $result = $this->cache->hget($this->cacheKey.'::'.$this->enterpriseId.'::'.$warehouseId, $skuId);
-        if (!$result) return '';
-        $returnData = json_decode($result, true);
-        if($type){
-            return $returnData[$type];
-        }
-        return $returnData;
-    }
-
-    /**
-     * 删除
-     * @param $skuId
-     * @param $warehouseId
-     */
-    public function delCacheHash($skuId, $warehouseId)
-    {
-        $this->cache->hdel($this->cacheKey.'::'.$this->enterpriseId.'::'.$warehouseId, $skuId);
-    }
-
-    /**---------------------------------------------商铺锁定--有序集合------------------------------------------------**/
-
-    /**
-     * 添加
-     */
-    public function addShopLock($shopId, $skuId, $shopLock)
-    {
-        $result = $this->cache->zadd($this->cacheKeyShopLock . '::' . $this->enterpriseId.'::'.$shopId, $shopLock, $skuId);
-        if($result){
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 查询
-     * @param $skuId
-     * @param $shopId
-     * @param bool $type
-     * @return mixed|string
-     */
-    public function getShopLock($shopId, $skuId)
-    {
-        return $this->cache->zscore($this->cacheKeyShopLock.'::'.$this->enterpriseId.'::'.$shopId, $skuId);
-    }
-
-    /**
-     * 删除
-     * @param $skuId
-     * @param $shopId
-     */
-    public function delShopLock($skuId, $shopId)
-    {
-        return $this->cache->zrem($this->cacheKeyShopLock.'::'.$this->enterpriseId.'::'.$shopId, $skuId);
-    }
-
-}

+ 0 - 81
Cache/MerchantCache.Class.php

@@ -1,81 +0,0 @@
-<?php
-/**
- * 商户cache添加
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/04/09
- * Time: 16:00
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class MerchantCache
-{
-    private $cache;
-
-    private $enterpriseId;
-
-    private $userCenterId;
-
-    private $cacheKey = 'Merchant';
-
-    public function __construct($enterpriseId = false, $userCenterId = false)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->userCenterId = $userCenterId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**---------------------------------------------商户------------------------------------------------**/
-
-    /**
-     * 添加
-     * @param $merchantId
-     * @param $merchantData
-     * @return bool
-     */
-    public function addMerchant($merchantId, $merchantData)
-    {
-        $data = json_encode($merchantData);
-        $result = $this->cache->hset($this->cacheKey, $merchantId, $data);
-        if(!$result){
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 查询
-     * @param $merchantId
-     * @param $key
-     * @return array
-     */
-    public function getMerchant($merchantId, $key = false)
-    {
-        $result = $this->cache->hget($this->cacheKey, $merchantId);
-        if (!$result) return [];
-        $returnData = json_decode($result, true);
-        if($key){
-            return $returnData[$key];
-        }
-        return $returnData;
-    }
-
-    /**
-     * 删除
-     * @param $merchantId
-     */
-    public function delMerchant($merchantId = false)
-    {
-        if($merchantId){
-            $this->cache->hdel($this->cacheKey, $merchantId);
-        }else{
-            $this->cache->del($this->cacheKey);
-        }
-    }
-
-}

+ 0 - 518
Cache/OverviewCache.Class.php

@@ -1,518 +0,0 @@
-<?php
-/**
- * 首页概况缓存
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/5
- * Time: 10:14
- */
-
-namespace JinDouYun\Cache;
-
-use http\Exception;
-use JinDouYun\Dao\Customer\DCustomer;
-use JinDouYun\Dao\Purchase\DSupplier;
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class OverviewCache
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-    private $expireTime = 86400;
-    private $orderDay = 7;//近7天订单趋势
-    protected $aggregateStatisticsKey = 'aggregateStatistics';//总数统计 区分企业
-    protected $businessOverviewEnterpriseKey = 'businessOverviewEnterprise';//经营概况_日期_企业Id_(全店)
-    protected $businessOverviewEnterpriseShopKey = 'businessOverviewEnterpriseShop';//经营概况_日期_企业Id_商铺id
-    protected $rankingEnterpriseKey = 'rankingEnterprise';//销量排行榜_日期_企业Id_(全店)
-    protected $rankingEnterpriseShopKey = 'rankingEnterpriseShop';//销量排行榜_日期_企业Id_商铺id
-    protected $salesMoneyRankingEnterpriseKey = 'salesMoneyRankingEnterprise';//销额排行榜_日期_企业Id_(全店)
-    protected $salesMoneyRankingEnterpriseShopKey = 'salesMoneyRankingEnterpriseShop';//销额排行榜_日期_企业Id_商铺id
-    protected $orderTrendKey = 'orderTrend';//近7天订单趋势_企业Id
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('finance');
-    }
-
-    /**
-     * 总数统计
-     * @param $enterpriseId
-     * @param string $key
-     * @param $change_num
-     * @return ResultWrapper
-     */
-    public function saveAggregateStatistics($enterpriseId, $key = 'totalShouldReceive', $change_num)
-    {
-        if (empty($key)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        $new = 0;
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->aggregateStatisticsKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        $ttl = $this->cache->ttl($Key);
-
-//        $old = self::getAggregateStatistics($enterpriseId,$key);
-
-        $objDCustomer = new DCustomer();
-        $objDSupplier = new DSupplier();
-        $objDCustomer->setTable('qianniao_customer_'.$enterpriseId);
-        $objDSupplier->setTable('qianniao_supplier_'.$enterpriseId);
-        if($key == 'totalShouldReceive'){
-            $tmpNew = $objDCustomer->query('select sum(money) as sum from '.$objDCustomer->get_Table().' where deleteStatus = '.StatusCode::$standard.' and enableStatus = '.StatusCode::$standard);
-        }
-        if($key == 'totalShouldPay'){
-            $tmpNew = $objDSupplier->query('select sum(money) as sum from '.$objDSupplier->get_Table().' where deleteStatus = '.StatusCode::$standard.' and enableStatus = '.StatusCode::$standard);
-        }
-        if(empty($tmpNew)){
-            $tmpNew[0]['sum'] = 0;
-        }
-        $this->cache->hset($Key , $key, bcadd($new,$tmpNew[0]['sum'],2));
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-    }
-
-    /**
-     * @param $enterpriseId
-     * @param $key
-     * @param $change_num
-     */
-    public function setAggregateStatistics($enterpriseId, $key, $change_num)
-    {
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->aggregateStatisticsKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        $ttl = $this->cache->ttl($Key);
-
-        $this->cache->hset($Key , $key, $change_num);
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-    }
-
-    /**
-     * 获取总数统计
-     * @param $enterpriseId
-     * @param $key
-     * @return array
-     */
-    public function getAggregateStatistics($enterpriseId, $key = 'totalShouldReceive')
-    {
-        $Key = $this->aggregateStatisticsKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        $result = $this->cache->hget($Key, $key);
-//        if(empty($result)){
-//            $objDCustomer = new DCustomer();
-//            $objDSupplier = new DSupplier();
-//            $objDCustomer->setTable('qianniao_customer_'.$enterpriseId);
-//            $objDSupplier->setTable('qianniao_supplier_'.$enterpriseId);
-//            if($key = 'totalShouldReceive'){
-//                $new = $objDCustomer->query('select sum(money) as sum from '.$objDCustomer->get_Table().' where deleteStatus = '.StatusCode::$standard.' and enableStatus = '.StatusCode::$standard);
-//            }
-//            if($key = 'totalShouldPay'){
-//                $new = $objDCustomer->query('select sum(money) as sum from '.$objDSupplier->get_Table().' where deleteStatus = '.StatusCode::$standard.' and enableStatus = '.StatusCode::$standard);
-//            }
-//            self::setAggregateStatistics($enterpriseId,$key, $new[0]['sum']);
-//        }
-        return $result ? $result : 0;
-    }
-
-    /**
-     * 删除总数统计
-     * @param $enterpriseId
-     * @param $key
-     * @return array
-     */
-    public function delAggregateStatistics($enterpriseId, $key = 'totalShouldReceive')
-    {
-        $Key = $this->aggregateStatisticsKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        return $this->cache->hdel($Key, $key);
-    }
-
-    /**************************经营概况 start**********************************/
-    /**
-     * 经营概况
-     * @param $enterpriseId
-     * @param string $key
-     * @param $change_num
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function saveBusinessOverview($enterpriseId, $key = 'orderTotalMoney', $change_num, $shopId = null)
-    {
-        if (empty($key)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->businessOverviewEnterpriseKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->businessOverviewEnterpriseShopKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId . '::ShopId_' . $shopId;
-        }
-
-        $ttl = $this->cache->ttl($Key);
-
-        $old = self::getBusinessOverview($enterpriseId, $key, $shopId);
-        $this->cache->hset($Key, $key, $old + $change_num);
-
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-    }
-
-    /**
-     * @param int $enterpriseId
-     * @param string $key
-     * @param string $change_num
-     * @param null $shopId
-     * @return bool
-     */
-    public function setBusinessOverview(int $enterpriseId,string $key,string $change_num, $shopId = null)
-    {
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->businessOverviewEnterpriseKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->businessOverviewEnterpriseShopKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId . '::ShopId_' . $shopId;
-        }
-        $ttl = $this->cache->ttl($Key);
-        $this->cache->hset($Key, $key, $change_num);
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-        return true;
-    }
-
-    /**
-     * 获取经营概况数字
-     * @param $enterpriseId
-     * @param string $key
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function getBusinessOverview($enterpriseId, $key = 'totalShouldReceive', $shopId = null)
-    {
-        if (empty($key)) {
-            return ResultWrapper::fail('要获取的key不存在', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->businessOverviewEnterpriseKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->businessOverviewEnterpriseShopKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId . '::ShopId_' . $shopId;
-        }
-
-        $result = $this->cache->hget($Key, $key);
-        return $result ? $result : 0;
-    }
-
-    /**
-     * 删除经营概况统计
-     * @param $enterpriseId
-     * @param string $key
-     * @param null $shopId
-     * @return mixed
-     */
-    public function delBusinessOverview($enterpriseId, $key = 'totalShouldReceive', $shopId = null)
-    {
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->businessOverviewEnterpriseKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->businessOverviewEnterpriseShopKey . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId . '::ShopId_' . $shopId;
-        }
-        return $this->cache->hdel($Key, $key);
-    }
-    /**************************经营概况 end**********************************/
-
-    /**************************销量排行榜 start**********************************/
-
-    /**
-     * 销量排行榜
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param string $id
-     * @param $change_num
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function saveRanking($enterpriseId, $suffix = 'categoryRanking', $id, $change_num, $shopId = null)
-    {
-        if (empty($suffix) || empty($id)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->rankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->rankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-
-        $ttl = $this->cache->ttl($Key);
-
-        $old = $this->cache->zscore($Key, $id);
-        $old = $old ? $old : 0;
-        $change_num = bcmul($change_num,100);
-        $this->cache->zAdd($Key, bcadd($old, $change_num), $id);
-
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-    }
-
-    /**
-     * 获取排行榜,按score从大到小排行
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param $id
-     * @param $change_num
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function getRanking($enterpriseId, $suffix = 'categoryRanking', $shopId = null)
-    {
-        if (empty($suffix)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->rankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->rankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-
-        $result = $this->cache->zRevRange($Key, 0, -1, true);
-        if(!empty($result)) {
-            foreach ($result as $key=>$value) {
-                if ($value) {
-                    $result[$key] = bcdiv($value,100,2);
-                }
-            }
-        }
-        return $result ? $result : [];
-    }
-
-    /**
-     * 删除排行榜 key
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param null $shopId
-     * @return mixed
-     */
-    public function delRanking($enterpriseId, $suffix = 'categoryRanking', $shopId = null)
-    {
-        $Key = $this->rankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->rankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-        return $this->cache->del($Key);
-    }
-
-    /**************************销量排行榜 end**********************************/
-
-    /**************************销额排行榜 start**********************************/
-
-    /**
-     * 销额排行榜
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param string $id
-     * @param $change_num
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function saveSalesMoneyRanking($enterpriseId, $suffix = 'categoryRanking', $id, $change_num, $shopId = null)
-    {
-        if (empty($suffix) || empty($id)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->salesMoneyRankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->salesMoneyRankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-
-        $ttl = $this->cache->ttl($Key);
-
-        $old = $this->cache->zscore($Key, $id);
-        $old = $old ? $old : 0;
-        $change_num = bcmul($change_num,100);
-        $this->cache->zAdd($Key, bcadd($old, $change_num), $id);
-
-        //如果键没有设置,那么设置过期时间
-        if ($ttl == -2) {
-            $this->cache->expire($Key, $this->expireTime);
-        }
-    }
-
-    /**
-     * 获取排行榜,按score从大到小排行
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param $id
-     * @param $change_num
-     * @param null $shopId
-     * @return ResultWrapper
-     */
-    public function getSalesMoneyRanking($enterpriseId, $suffix = 'categoryRanking', $shopId = null)
-    {
-        if (empty($suffix)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        //获取Key的过期时间,大于0的话就不再设置了
-        $Key = $this->salesMoneyRankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->salesMoneyRankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-
-        $result = $this->cache->zRevRange($Key, 0, -1, true);
-        if(!empty($result)) {
-            foreach ($result as $key=>$value) {
-                if ($value) {
-                    $result[$key] = bcdiv($value,100,2);
-                }
-            }
-        }
-        return $result ? $result : [];
-    }
-
-    /**
-     * 删除排行榜 key
-     * @param $enterpriseId
-     * @param string $suffix
-     * @param null $shopId
-     * @return mixed
-     */
-    public function delSalesMoneyRanking($enterpriseId, $suffix = 'categoryRanking', $shopId = null)
-    {
-        $Key = $this->salesMoneyRankingEnterpriseKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId;
-        if (!empty($shopId)) {
-            $Key = $this->salesMoneyRankingEnterpriseShopKey . '::' . $suffix . '::' . date('Y-m-d') . '::EnterpriseId_' . $enterpriseId.'::ShopId_'. $shopId;
-        }
-        return $this->cache->del($Key);
-    }
-
-    /**************************销额排行榜 end**********************************/
-
-
-    /**************************近7天订单趋势 start**********************************/
-    /**
-     * 近7天订单趋势   订单审核后调用此方法
-     * @param $enterpriseId
-     * @param $orderMoney
-     * @param $goodsNum 商品数量
-     * @return void
-     */
-    public function saveOrderTrend($enterpriseId, $orderMoney, $goodsNum)
-    {
-        $Key = $this->orderTrendKey. '::EnterpriseId_' . $enterpriseId;
-
-        //删除前30天的值
-        $keys = $this->cache->hkeys($Key);
-        if(!empty($keys)) {
-            foreach ($keys as $k) {
-                if(strtotime($k) <= strtotime('-30 days')) {
-                    $this->cache->hdel($Key, $k);
-                }
-            }
-        }
-
-        //获取今天的值
-        $oldValue = $this->cache->hget($Key, date('Y-m-d'));
-        if(!empty($oldValue)) {
-            $oldValue = json_decode($oldValue, true);
-        }
-        $newValue = [
-            'orderMoney'=> $orderMoney + (isset($oldValue['orderMoney']) ? $oldValue['orderMoney'] : 0),
-            'goodsNum'=> $goodsNum + (isset($oldValue['goodsNum']) ? $oldValue['goodsNum'] : 0),
-            'orderNum'=> 1 + (isset($oldValue['orderNum']) ? $oldValue['orderNum'] : 0),
-        ];
-        $this->cache->hset($Key, date('Y-m-d'), json_encode($newValue));
-    }
-
-    /**
-     * 获取近7天订单趋势
-     * @param $enterpriseId
-     * @return ResultWrapper
-     */
-    public function getOrderTrend($enterpriseId)
-    {
-        $Key = $this->orderTrendKey. '::EnterpriseId_' . $enterpriseId;
-        $result = [];
-        for($i=6; $i>=0; $i--) {
-            $date = date('Y-m-d',strtotime("-$i days"));
-            $value = $this->cache->hget($Key, $date);
-
-            $value = empty($value) ? [] : json_decode($value, true);
-
-            $result[] = [
-                'date'       => $date,
-                'orderMoney' => isset($value['orderMoney']) ? $value['orderMoney'] : 0,
-                'goodsNum'   => isset($value['goodsNum']) ? $value['goodsNum'] : 0,
-                'orderNum'   => isset($value['orderNum']) ? $value['orderNum'] : 0,
-            ];
-        }
-
-        return $result;
-    }
-
-    /**************************近7天订单趋势 end**********************************/
-
-    /**
-     * 未出库订单总数
-     * shopId为键 count为值
-     * @param $enterpriseId
-     * @param $shopId
-     * @param $count
-     * @return bool
-     */
-    public function setStatisticsCountInventoryOut($enterpriseId, $shopId, $count)
-    {
-        $key = $this->businessOverviewEnterpriseKey . '::OrderNumOfNotOutOfStock::EnterpriseId_' . $enterpriseId;
-         return $this->cache->zadd($key, $count, $shopId);
-    }
-
-    public function getStatisticsCountInventoryOut($enterpriseId, $shopId)
-    {
-        $key = $this->businessOverviewEnterpriseKey . '::OrderNumOfNotOutOfStock::EnterpriseId_' . $enterpriseId;
-        return $this->cache->zscore($key, $shopId);
-    }
-
-    public function delStatisticsCountInventoryOut($enterpriseId, $shopId)
-    {
-        $key = $this->businessOverviewEnterpriseKey . '::OrderNumOfNotOutOfStock::EnterpriseId_' . $enterpriseId;
-        $this->cache->zrem($key, 0);
-        return $this->cache->zrem($key, $shopId);
-
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}

+ 0 - 77
Cache/PageCache.Class.php

@@ -1,77 +0,0 @@
-<?php
-/**
- * 小程序商品首页数据cache
-* Created by PhpStorm.
-* User: kang
-* Date: 2021/7/12
-* Time: 18:15
-*/
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class PageCache
-{
-    private $cache;
-    
-    private $enterpriseId;
-    
-    private $userCenterId;
-    
-    private $cacheKey = 'Page';
-    
-    public function __construct($enterpriseId = false, $userCenterId = false)
-    {
-        $this->enterpriseId = $enterpriseId;
-        $this->userCenterId = $userCenterId;
-        $this->cache = Factory::cache('default');
-    }
-    
-    /**---------------------------------------------小程序首页------------------------------------------------**/
-    
-    /**
-     * 添加
-     * @param $md5Key
-     * @param $pageData
-     * @return bool
-     */
-    public function addPage($md5Key, $pageData)
-    {
-        $data = json_encode($pageData);
-        $result = $this->cache->hset($this->cacheKey, $md5Key, $data);
-        if(!$result){
-            return false;
-        }
-        return true;
-    }
-    
-    /**
-     * 查询
-     * @param $md5Key
-     * @return array
-     */
-    public function getPage($md5Key)
-    {
-        $result = $this->cache->hget($this->cacheKey, $md5Key);
-        if (!$result) return [];
-        $returnData = json_decode($result, true);
-        
-        return $returnData;
-    }
-    
-    /**
-     * 删除
-     * @param $paegId
-     */
-    public function delPage($paegId = false)
-    {
-        if($paegId){
-            $this->cache->hdel($this->cacheKey, $paegId);
-        }else{
-            $this->cache->del($this->cacheKey);
-        }
-    }
-    
-}

+ 0 - 118
Cache/PauseSave.Class.php

@@ -1,118 +0,0 @@
-<?php
-/**
- * 暂存cache
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/03/30
- * Time: 16:30
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class PauseSave
-{
-    private $cache;
-
-    private $enterpriseId;
-
-    private $userCenterId;
-
-    private $cacheBigKey;
-
-    private $pauseSaveTime = '86400';//暂存保存时间
-
-    private static $cacheKey = 'PauseSave';
-
-    private $moneyCacheKey = 'MoneyPauseSave';
-
-    public function __construct($enterpriseId, $userCenterId = false)
-    {
-        $userCenterId && $this->userCenterId = $userCenterId;
-        $enterpriseId && $this->enterpriseId = $enterpriseId;
-        $this->cacheBigKey = '';
-        if($enterpriseId && $userCenterId){
-            $this->cacheBigKey = self::$cacheKey.'::'.$this->enterpriseId . '_' . $this->userCenterId;
-            $this->moneyCacheKey = $this->moneyCacheKey.'::'.$this->enterpriseId . '_' . $this->userCenterId;
-        }
-        $this->cache = Factory::cache('default');
-    }
-
-    /**---------------------------------------------哈希hash------------------------------------------------**/
-
-    /**
-     * 添加
-     * @param $key
-     * @param $value
-     * @return bool
-     */
-    public function addCacheHash($key,$value)
-    {
-        $data = json_encode($value);
-        $result = $this->cache->hset($this->cacheBigKey, $key, $data);
-        if (!$result) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 查询
-     * @param $key
-     * @return mixed|string
-     */
-    public function getCacheHash($key)
-    {
-        $result = $this->cache->hget($this->cacheBigKey, $key);
-        if (!$result) return [];
-        return json_decode($result, true);
-    }
-
-    /**
-     * 删除
-     * @param $key
-     * @return array
-     */
-    public function delCacheHash($key)
-    {
-        return $this->cache->hdel($this->cacheBigKey, $key);
-    }
-
-
-    /***********************************价格暂存**************************************/
-    /**
-     * 添加
-     * @param $key
-     * @param $array
-     * @return bool
-     * @throws \Exception
-     */
-    public function addMoneyCache($array)
-    {
-        if(empty($array)){
-            return false;
-        }
-
-        $pipe =  Factory::cache('default')->multi();
-        foreach ($array as $key => $value){
-            Factory::cache('default')->zadd($this->moneyCacheKey, $value, $key);
-        }
-        $pipe->exec();
-
-        return true;
-    }
-
-    /**
-     * 查询
-     * @param $key
-     * @return mixed|string
-     */
-    public function getMoneyCache($key)
-    {
-        $result = $this->cache->zscore($this->moneyCacheKey, $key);
-        return $result;
-    }
-}

+ 0 - 211
Cache/PriceCache.Class.php

@@ -1,211 +0,0 @@
-<?php
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Factory;
-
-/**
- * 价格缓存
- * Class PriceCache
- * @package JinDouYun\Cache
- */
-class PriceCache
-{
-    /**
-     * 全国价缓存key
-     * @var string
-     */
-    private static $nationSalePriceTableKey = 'nationSalePrice::';
-
-    /**
-     * 客户调价信息缓存
-     * @var string
-     */
-    private static $customerAdjTableKey = 'customerAdj::';
-
-    /**
-     * 客户类型调价信息
-     * @var string
-     */
-    private static $customerTypeAdiTableKey = 'customerTypeAdi::';
-
-    /**
-     * @var string 价格波动
-     */
-    private static $priceTrend = 'priceTrend_';
-
-    /**
-     * @var integer
-     */
-    private $onlineEnterpriseId;
-
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    /**
-     * PriceCache constructor.
-     * @param $enterpriseId
-     * @throws \Exception
-     */
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**********缓存NationSalePrice数据***************/
-    /**
-     *
-     * 缓存全国价 goodsId=>$value
-     * @param int $goodsId
-     * @param $value
-     * @return bool|int
-     */
-    public function setNationSalePrice(int $goodsId, $value)
-    {
-        return $this->cache->hset(self::$nationSalePriceTableKey . $this->onlineEnterpriseId, $goodsId, json_encode($value));
-    }
-
-    /**
-     *
-     * 获取全国价 goodsId=>$value
-     * @param int $goodsId
-     * @return mixed
-     */
-    public function getNationSalePrice(int $goodsId)
-    {
-        $result = $this->cache->hget(self::$nationSalePriceTableKey . $this->onlineEnterpriseId, $goodsId);
-        if (empty($result)) {
-            return [];
-        }
-        $result = json_decode($result, true);
-        return $result;
-    }
-
-    /**
-     * 删除全国价 goodsId=>$value
-     * @param int $goodsId
-     * @return bool|int
-     */
-    public function delNationSalePrice(int $goodsId)
-    {
-        return $this->cache->hdel(self::$nationSalePriceTableKey . $this->onlineEnterpriseId, $goodsId);
-    }
-
-    /**********缓存客户调价信息数据***************/
-
-    /**
-     * 缓存客户类型价格信息
-     * filed 客户id_商品id
-     * @param int $goodsId
-     * @param int $customerId
-     * @param $value
-     * @return bool|int
-     */
-    public function setCustomerAdj(int $goodsId, int $customerId, $value)
-    {
-        return $this->cache->hset(self::$customerAdjTableKey . $this->onlineEnterpriseId, $customerId . '_' . $goodsId, json_encode($value));
-    }
-
-    /**
-     * 获取客户调价信息
-     * @param int $goodsId
-     * @param int $customerId
-     * @return array|mixed|string
-     */
-    public function getCustomerAdj(int $goodsId, int $customerId)
-    {
-        $result = $this->cache->hget(self::$customerAdjTableKey . $this->onlineEnterpriseId, $customerId . '_' . $goodsId);
-        if (empty($result)) {
-            return [];
-        }
-        $result = json_decode($result, true);
-        return $result;
-    }
-
-    /**
-     * 删除客户调价信息
-     * @param int $goodsId
-     * @param int $customerId
-     * @return bool|int
-     */
-    public function delCustomerAdj(int $goodsId,int $customerId)
-    {
-        return $this->cache->hdel(self::$customerAdjTableKey . $this->onlineEnterpriseId, $customerId . '_' . $goodsId);
-    }
-
-    /*****缓存客户类型调价信息*******/
-    /**
-     * 缓存客户类型调价信息
-     * @param int $goodsId
-     * @param int $customerType
-     * @param $value
-     * @return bool|int
-     */
-    public function setCustomerTypeAdj(int $goodsId, int $customerType, $value)
-    {
-        return $this->cache->hset(self::$customerTypeAdiTableKey.$this->onlineEnterpriseId,$customerType.'_'.$goodsId,json_encode($value));
-    }
-
-    /**
-     * 获取客户类型调价信息
-     * @param int $goodsId
-     * @param int $customerType
-     * @return array|mixed|string
-     */
-    public function getCustomerTypeAdj(int $goodsId, int $customerType)
-    {
-        $result = $this->cache->hget(self::$customerTypeAdiTableKey . $this->onlineEnterpriseId, $customerType . '_' . $goodsId);
-        if (empty($result)) {
-            return [];
-        }
-        $result = json_decode($result, true);
-        return $result;
-    }
-
-    /**
-     * 删除客户类型调价信息
-     * @param int $goodsId
-     * @param int $customerType
-     * @return bool|int
-     */
-    public function delCustomerTypeAdj(int $goodsId, int $customerType)
-    {
-        return $this->cache->hdel(self::$customerTypeAdiTableKey . $this->onlineEnterpriseId, $customerType . '_' . $goodsId);
-    }
-
-    /**
-     * Doc: (des="缓存价格波动数据")
-     * User: XMing
-     * Date: 2021/3/11
-     * Time: 12:02 下午
-     * @param int $goodsId
-     * @param string $value
-     * @param int $ttl
-     * @return bool|mixed
-     */
-    public function setPriceTrend(int $goodsId,string $value,int $ttl = 60): bool
-    {
-        return $this->cache->set(self::$priceTrend . $this->onlineEnterpriseId.'_'.$goodsId,$value,$ttl);
-    }
-
-    /**
-     * Doc: (des="获取缓存价格波动数据")
-     * User: XMing
-     * Date: 2021/3/11
-     * Time: 12:16 下午
-     * @param int $goodsId
-     */
-    public function getPriceTrend(int $goodsId)
-    {
-        return [];
-        $result = $this->cache->get(self::$priceTrend . $this->onlineEnterpriseId.'_'.$goodsId);
-        if (empty($result)){
-            return [];
-        }
-        return $result;
-    }
-}

+ 0 - 326
Cache/RoleAclCache.Class.php

@@ -1,326 +0,0 @@
-<?php
-namespace Jindouyun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class RoleAclCache
-{
-    private $cache;
-    protected $StaffRelationRoleKey = 'staffRelationRole';//缓存员工和角色的关系
-    protected $RoleRelationAclKey = 'roleRelationAcl';//缓存角色和权限的关系 hash
-    protected $staffRelationDataFieldKey = 'staffUidRelationDataField';//缓存员工和数据域的关系 hash
-    protected $staffIdRelationUidKey = 'staffIdRelationUid';//缓存职工id和uid的关系 hash
-    protected $uidRelationStaffIdKey = 'uidRelationStaffIdKey';//缓存uid和职工id的关系 hash
-    protected $shopIdRelationWarehouseIdKey = 'shopIdRelationWarehouseId';//缓存商铺和仓库的关系 hash
-    protected $authority = 'Authority';//权限缓存
-    protected $Administrator = 'AdministratorRole';//超级管理员角色
-    protected $authorityBindRole = 'AuthorityBindRole';//角色绑定权限
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('user');
-    }
-    /*******************  start:缓存员工和角色的关系   value:userCenterId  score:roleId   **************/
-
-    /**
-     * 缓存员工和角色的关系
-     * @param $enterpriseId
-     * @param $uid
-     * @param $roleId
-     */
-    public function cacheStaffAndRole($enterpriseId, $uid, $roleId)
-    {
-        $this->cache->zadd($this->StaffRelationRoleKey.'::'.$enterpriseId, $roleId, $uid);
-    }
-
-    /**
-     * 获取员工的角色Id
-     * @param $enterpriseId
-     * @param $uid
-     * @return mixed
-     */
-    public function getRoleIdOfStaff($enterpriseId, $uid)
-    {
-        $result =  $this->cache->zrange($this->StaffRelationRoleKey.'::'.$enterpriseId, 0,-1, true);
-        return isset($result[$uid]) ? (int)$result[$uid] : '';
-    }
-
-    /**
-     * 删除userCenterId和roleId的绑定关系
-     * @param $enterpriseId
-     * @param $uid
-     */
-    public function deleteStaffRelationRole($enterpriseId, $uid)
-    {
-        $this->cache->zrem($this->StaffRelationRoleKey.'::'.$enterpriseId , $uid);
-    }
-    /*******************  end:缓存员工和角色的关系   value:userCenterId  score:roleId     **************/
-
-
-
-    /*******************  start:角色与权限的关系 **************/
-
-    /**
-     * 缓存 角色组id 和 权限
-     * @param $enterpriseId
-     * @param $roleId
-     * @param $aclData
-     * @return mixed
-     */
-    public function cacheRoleIdAndAcl($enterpriseId, $roleId, $aclData = [])
-    {
-        return $this->cache->hset($this->RoleRelationAclKey.'::'.$enterpriseId, $roleId, json_encode($aclData));
-    }
-
-    /**
-     * 删除角色组对应的权限
-     * @param $enterpriseId
-     * @param $roleId
-     * @return mixed
-     */
-    public function delRoleIdAndAcl($enterpriseId, $roleId)
-    {
-        return $this->cache->hdel($this->RoleRelationAclKey.'::'.$enterpriseId, $roleId);
-    }
-
-    /**
-     * 获取角色组对应的权限
-     * @param $enterpriseId
-     * @param $roleId
-     * @return mixed
-     */
-    public function getRoleIdAndAcl($enterpriseId, $roleId)
-    {
-        $aclResult = $this->cache->hget($this->RoleRelationAclKey.'::'.$enterpriseId, $roleId);
-        return !empty($aclResult) ? json_decode($aclResult, true) : [];
-    }
-
-    /*******************  end:角色与权限的关系   **************/
-
-
-    /*******************  start:员工与数据域的关系 **************/
-
-    /**
-     * 缓存 员工的userCenterid 和 数据域对象
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $dataField
-     * @return mixed
-     */
-    public function cacheStaffUidAndDataField($enterpriseId, $userCenterId, $dataField = [])
-    {
-        return $this->cache->hset($this->staffRelationDataFieldKey.'::'.$enterpriseId, $userCenterId, json_encode($dataField));
-    }
-
-    /**
-     * 删除员工的userCenterid 和 数据域对象  的关联
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function delStaffUidAndDataField($enterpriseId, $userCenterId)
-    {
-        return $this->cache->hdel($this->staffRelationDataFieldKey.'::'.$enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 获取员工的userCenterid 和 数据域对象  的关联
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function getStaffUidAndDataField($enterpriseId, $userCenterId)
-    {
-        $dataField = $this->cache->hget($this->staffRelationDataFieldKey.'::'.$enterpriseId, $userCenterId);
-        return !empty($dataField) ? json_decode($dataField, true) : [];
-    }
-
-    /*******************  end:员工与数据域的关系   **************/
-
-    /*******************  start:职工id与userCenterId的关系   **************/
-
-    /**
-     * 缓存 职工id与userCenterId的关系
-     * @param $enterpriseId
-     * @param $staffId
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function cacheStaffIdAndUserCenterId($enterpriseId, $userCenterId, $staffId)
-    {
-        return $this->cache->hset($this->staffIdRelationUidKey.'::'.$enterpriseId, $userCenterId, $staffId);
-    }
-
-    /**
-     * 获取职工id与userCenterId的关系
-     * @param $enterpriseId
-     * @param $staffId
-     * @return mixed
-     */
-    public function getStaffIdAndUserCenterId($enterpriseId, $userCenterId)
-    {
-        $staffId = $this->cache->hget($this->staffIdRelationUidKey.'::'.$enterpriseId, $userCenterId);
-        return $staffId ? $staffId : '';
-    }
-    /*******************  end:职工id与userCenterId的关系   **************/
-
-
-    /*******************  start:userCenterId和职工id的关系   **************/
-
-    /**
-     * @param $enterpriseId
-     * @param $staffId
-     * @param $userCenterId
-     * @return mixed
-     */
-    public function cacheUserCenterIdAndStaffId($enterpriseId, $staffId, $userCenterId)
-    {
-        return $this->cache->hset($this->uidRelationStaffIdKey.'::'.$enterpriseId, $staffId, $userCenterId);
-    }
-
-    /**
-     * @param $enterpriseId
-     * @param $staffId
-     * @return mixed
-     */
-    public function getUserCenterIdAndStaffId($enterpriseId, $staffId)
-    {
-        $userCenterId = $this->cache->hget($this->uidRelationStaffIdKey.'::'.$enterpriseId, $staffId);
-        return $userCenterId ? $userCenterId : '';
-    }
-    /*******************  end:userCenterId和职工id的关系   **************/
-
-    /*******************  start:商铺和仓库的关系   **************/
-
-    /**
-     * @param $enterpriseId
-     * @param $shopId
-     * @param $warehouseId
-     * @return mixed
-     */
-    public function cacheShopIdAndWarehouseId($enterpriseId, $shopId, $warehouseId)
-    {
-        return $this->cache->hset($this->shopIdRelationWarehouseIdKey.'::'.$enterpriseId, $shopId, $warehouseId);
-    }
-
-    /**
-     * @param $enterpriseId
-     * @param $shopId
-     * @return mixed
-     */
-    public function getShopIdAndWarehouseId($enterpriseId, $shopId)
-    {
-        $warehouseId = $this->cache->hget($this->shopIdRelationWarehouseIdKey.'::'.$enterpriseId, $shopId);
-        return $warehouseId ? $warehouseId : '';
-    }
-    /*******************  end:商铺和仓库的关系   **************/
-
-
-    /*******************权限缓存 (无序集合)  **************/
-    /**
-     * 权限新增
-     * @param $id
-     * @param $value
-     * @return mixed
-     */
-    public function addAuthority($value)
-    {
-        return $this->cache->sadd($this->authority, strtolower($value));
-    }
-
-    /**
-     * 权限查询
-     * @param $value
-     * @return mixed
-     */
-    public function getAuthority($value)
-    {
-        return $this->cache->sismember($this->authority, strtolower($value));
-    }
-
-    /**
-     * 权限删除
-     * @param $value
-     * @return mixed
-     */
-    public function delAuthority($value)
-    {
-        return $this->cache->srem($this->authority, strtolower($value));
-    }
-
-    /***********************超级管理员角色*******************
-     * 新增
-     * @param $enterpriseId
-     * @param $value
-     * @return mixed
-     */
-    public function addAdministrator($enterpriseId, $value)
-    {
-        return $this->cache->sadd($this->Administrator.'::'.$enterpriseId, $value);
-    }
-
-    /**
-     * 查询
-     * @param $enterpriseId
-     * @param $value
-     * @return mixed
-     */
-    public function getAdministrator($enterpriseId, $value)
-    {
-        return $this->cache->sismember($this->Administrator.'::'.$enterpriseId, $value);
-    }
-
-    /**
-     * 删除
-     * @param $enterpriseId
-     * @param $value
-     * @return mixed
-     */
-    public function delAdministrator($enterpriseId, $value)
-    {
-        return $this->cache->srem($this->Administrator.'::'.$enterpriseId, $value);
-    }
-
-    /***********************角色绑定权限*******************
-     * 新增
-     * @param $enterpriseId
-     * @param $roleId
-     * @param $value
-     * @return mixed
-     */
-    public function addAuthorityBindRole($enterpriseId, $roleId,  $value)
-    {
-        return $this->cache->sadd($this->authorityBindRole.'::'.$enterpriseId.'::'.$roleId, strtolower($value));
-    }
-
-    /**
-     * 查询
-     * @param $enterpriseId
-     * @param $roleId
-     * @param $value
-     * @return mixed
-     */
-    public function getAuthorityBindRole($enterpriseId, $roleId, $value)
-    {
-        return $this->cache->sismember($this->authorityBindRole.'::'.$enterpriseId.'::'.$roleId, strtolower($value));
-    }
-
-    /**
-     * 删除
-     * @param $enterpriseId
-     * @param $roleId
-     * @param $value
-     * @return mixed
-     */
-    public function delAuthorityBindRole($enterpriseId, $roleId,  $value = '')
-    {
-        if($value){
-            return $this->cache->srem($this->authorityBindRole.'::'.$enterpriseId.'::'.$roleId, strtolower($value));
-        }else{
-            return $this->cache->del($this->authorityBindRole.'::'.$enterpriseId.'::'.$roleId);
-        }
-    }
-}

+ 0 - 111
Cache/ShopCache.Class.php

@@ -1,111 +0,0 @@
-<?php
-/**
- * 企业和商铺关联缓存
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/5
- * Time: 10:14
- */
-
-namespace JinDouYun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class ShopCache
-{
-    private $cache;
-    protected $EnterpriseRelationShopKey = 'EnterpriseRelationShop';//企业和商铺关联缓存
-    protected $EnterpriseSalesAreaKey = 'EnterpriseSalesArea';//企业下商铺的销售区域
-    protected $shopToken = 'ShopToken';//商铺token
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('default');
-    }
-
-    /**
-     * 缓存企业和商铺关系数据
-     * @param $enterpriseId
-     * @param $shopData
-     * @return ResultWrapper
-     */
-    public function cacheEnterpriseAndShop($enterpriseId, $shopData)
-    {
-        if( empty($shopData) ){
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        // 写入之前先清理
-        self::cleanUserRelationEnterprise($enterpriseId);
-        $pipe =  $this->cache->multi();
-        foreach ($shopData as $key => $value){
-            $writeCache = $this->cache->sadd($this->EnterpriseRelationShopKey.'::'.$enterpriseId, $value['id']);
-        }
-        $pipe->exec();
-    }
-
-    /**
-     * 判断当前商铺id是否在当前企业下
-     * @param $enterpriseId
-     * @param $shopId
-     * @return boolean
-     */
-    public function isHaveShopId($enterpriseId, $shopId)
-    {
-        $result =  $this->cache->sismember($this->EnterpriseRelationShopKey.'::'.$enterpriseId, $shopId);
-        return $result;
-    }
-
-    /**
-     * 清除指定企业和商铺关联数据
-     * @param $enterpriseId
-     */
-    public function cleanUserRelationEnterprise($enterpriseId)
-    {
-        $result =  $this->cache->del($this->EnterpriseRelationShopKey.'::'.$enterpriseId);
-    }
-
-    /**
-     * 缓存企业下所有商铺的销售区域
-     * @param $enterpriseId
-     * @param array $salesArea
-     */
-    public function cacheEnterpriseSalesArea($enterpriseId,$salesArea=[]) {
-        $this->cache->hset($this->EnterpriseSalesAreaKey, $enterpriseId, json_encode(array_unique($salesArea)));
-    }
-
-    /**
-     * 获取企业下的销售区域
-     * @param $enterpriseId
-     * @return mixed
-     */
-    public function getEnterpriseSalesArea($enterpriseId) {
-        return $this->cache->hget($this->EnterpriseSalesAreaKey, $enterpriseId);
-    }
-
-    /**
-     * 缓存商铺token
-     * @param $enterpriseId
-     * @param $shopId
-     * @param $token
-     * @return bool
-     */
-    public function setShopToken($enterpriseId, $shopId, $token)
-    {
-        return $this->cache->zadd($this->shopToken.'::'.$enterpriseId, $shopId, $token);
-    }
-
-    /**
-     * 根据token获取商铺id  反解token需要
-     * @param $enterpriseId
-     * @param $token
-     * @return float
-     */
-    public function getShopToken($enterpriseId, $token)
-    {
-        return $this->cache->zscore($this->shopToken.'::'.$enterpriseId, $token);
-    }
-}

+ 0 - 121
Cache/SkuCache.Class.php

@@ -1,121 +0,0 @@
-<?php
-
-namespace JinDouYun\Cache;
-
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-use Mall\Framework\Cache\Redis;
-
-class SkuCache
-{
-
-    private $onlineEnterpriseId;
-
-    private static $skuKey = 'skuHash';
-
-    private static $goodsBasicSkuKey = 'goodsBasicSku';
-
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**
-     * @param int $skuId
-     * @param array $data
-     * @return ResultWrapper
-     */
-    public function cacheSku(int $skuId,array $data)
-    {
-        $data = gzcompress(serialize($data));
-        $result = $this->cache->hset(self::$skuKey. '::' . $this->onlineEnterpriseId, $skuId, $data);
-        if ($result) {
-            return ResultWrapper::success('添加缓存成功');
-        } else {
-            return ResultWrapper::fail('添加缓存失败', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * $fields
-     * true : 返回所有字段信息(array)
-     * field : 返回对应字段值 (string)
-     * @param int $skuId
-     * @param string $fields
-     * @return array|bool|mixed|string
-     */
-    public function getSku(int $skuId, $fields='unitName')
-    {
-        $result = $this->cache->hget(self::$skuKey . '::' . $this->onlineEnterpriseId, $skuId);
-        if(empty($result) || $result == false) return '';
-        $result = unserialize(zlib_decode($result));
-        $result['extends'] = empty($result['extends']) ? [] : json_decode($result['extends'],true);
-        if($fields === true){
-            return $result;
-        }
-        if (isset($result[$fields])){
-            return $result[$fields];
-        }
-        return '';
-    }
-
-    /**
-     * @param int $skuId
-     * @return bool|int
-     */
-    public function delSku(int $skuId)
-    {
-        return $this->cache->hdel(self::$skuKey . '::' . $this->onlineEnterpriseId, $skuId);
-    }
-
-    /********************************以商品基础资料id为key*******************************/
-    /**
-     * 添加sku
-     * @param int $goodsBasicId
-     * @param array $data
-     * @return ResultWrapper
-     */
-    public function addGoodsBasicSku(int $goodsBasicId,array $data)
-    {
-        $data = gzcompress(serialize($data));
-        $result = $this->cache->hset(self::$goodsBasicSkuKey. '::' . $this->onlineEnterpriseId, $goodsBasicId, $data);
-        if ($result) {
-            return ResultWrapper::success('添加缓存成功');
-        } else {
-            return ResultWrapper::fail('添加缓存失败', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 获取sku
-     * true : 返回所有字段信息(array)
-     * field : 返回对应字段值 (string)
-     * @param int $goodsBasicId
-     * @return array|bool|mixed|string
-     */
-    public function getGoodsBasicSku($goodsBasicId)
-    {
-        $result = $this->cache->hget(self::$goodsBasicSkuKey . '::' . $this->onlineEnterpriseId, $goodsBasicId);
-        if(empty($result) || $result == false) return [];
-        $result = unserialize(zlib_decode($result));
-        return $result;
-    }
-
-    /**
-     * 删除sku
-     * @param int $goodsBasicId
-     * @return bool|int
-     */
-    public function delGoodsBasicSku(int $goodsBasicId)
-    {
-        return $this->cache->hdel(self::$goodsBasicSkuKey . '::' . $this->onlineEnterpriseId, $goodsBasicId);
-    }
-}

+ 0 - 80
Cache/SmsVerification.Class.php

@@ -1,80 +0,0 @@
-<?php
-
-namespace Jindouyun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class SmsVerification
-{
-    private $cache;
-    protected $registerSmsCountKey = 'registerSmsCount_'; //当天每个手机号发送验证码次数
-    protected $key = '';
-    protected $userRegisterSmsCodeExpire = 300;//短信验证码过期时间
-    protected $registerSms = 'registerSms'; //当前手机号发送的验证码
-
-    public function __construct()
-    {
-        $this->key = $this->registerSmsCountKey . date('Y-m-d', time());
-        $this->cache = Factory::cache('default');
-    }
-
-    /**
-     * 缓存用户注册时发送的短信验证码
-     * @param $mobile
-     * @param $mobileCode
-     * @return ResultWrapper
-     */
-    public function userMobileCodeCache($mobile, $mobileCode)
-    {
-        if (empty($mobileCode)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-
-        $result = $this->cache->set($this->registerSms . '::' . $mobile, $mobileCode, $this->userRegisterSmsCodeExpire);
-
-        if ($result) {
-            //增加当天用户发送短信次数
-            $returnData = $this->cache->zincrby($this->key, 1, $mobile);
-            if ($returnData) {
-                $this->cache->expire($this->key, 86400);
-            }
-            return ResultWrapper::success('用户注册手机验证码写入缓存成功');
-        } else {
-            return ResultWrapper::fail('用户注册手机验证码写入缓存失败', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 获取指定手机号的短信验证码
-     * @param $mobile
-     * @return string
-     * @throws \Exception
-     */
-    public function getMobileCode($mobile)
-    {
-        if (!$mobile) {
-            return '';
-        }
-
-        $result = Factory::cache('default')->get($this->registerSms . '::' . $mobile);
-
-        if (!$result) {
-            return '';
-        }
-
-        return $result;
-    }
-
-    /**
-     * 查询当天用户发送短信次数
-     * @param $mobile
-     * @return mixed
-     */
-    public function getRegisterSmsCount($mobile)
-    {
-        return $this->cache->zscore($this->key, $mobile);
-    }
-}

+ 0 - 93
Cache/SpecCache.Class.php

@@ -1,93 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-/**
- * 规格缓存
- * Class SpecCache
- * @package JinDouYun\Cache
- */
-class SpecCache
-{
-    /**
-     * 企业ID
-     * @var
-     */
-    private $onlineEnterpriseId;
-
-    /**
-     * redis
-     * @var
-     */
-    private $cache;
-
-    /**
-     * SpecName=>id
-     * @var
-     */
-    private $specNameRelIdKey = 'SpecNameRelId';
-
-    /**
-     * SpecCache constructor.
-     * @param $enterpriseId
-     * @throws \Exception
-     */
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**
-     * SpecName => id
-     * @param $specName
-     * @param $id
-     * @return ResultWrapper
-     */
-    public function cacheSpecNameRelId($specName, $id)
-    { 
-        return $this->cache->zadd($this->specNameRelIdKey.'::'.$this->onlineEnterpriseId, $id, $specName);
-    }
-
-    /**
-     * del
-     * @param $id
-     * @return mixed
-     */
-    public function delSpecNameRelId($id)
-    {
-        return $this->cache->zremrangebyscore($this->specNameRelIdKey.'::'.$this->onlineEnterpriseId, $id,$id);
-    }
-
-    /**
-     * get id => specName
-     * @param $id
-     * @return string
-     */
-    public function getSpecNameById($id)
-    {
-        $result = $this->cache->zrangebyscore($this->specNameRelIdKey.'::'.$this->onlineEnterpriseId, $id, $id);
-        if (!$result) {
-            return '';
-        }
-        return array_shift($result);
-    }
-
-    /**
-     * get specName => id
-     * @param $specName
-     * @return int
-     */
-    public function getIdBySpecName($specName)
-    {
-        $result = $this->cache->zscore($this->specNameRelIdKey.'::'.$this->onlineEnterpriseId, $specName);
-        if (!$result) return 0;
-        return $result;
-    }
-
-}

+ 0 - 139
Cache/Stock.Class.php

@@ -1,139 +0,0 @@
-<?php
-/**
- * 缓存库存数据
- * Created by PhpStorm.
- * User: 小威
- * Date: 2019/12/10
- * Time: 15:56
- */
-
-namespace JinDouYun\Cache;
-
-use Exception;
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class Stock
-{
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    private $onlineEnterpriseId;
-
-
-    protected $StockKey = 'StockStatistics';
-
-    /**
-     * @var string
-     */
-    private $serialNumKey = 'SerialNum';
-
-    /**
-     * GoodsBasicCache constructor.
-     * @param $enterpriseId
-     * @throws Exception
-     */
-    public function __construct($enterpriseId)
-    {
-        $this->onlineEnterpriseId = $enterpriseId;
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**
-     * 缓存统计
-     * @param $value  $缓存的字段名 value
-     * @param $score $缓存的值 score
-     * @param $key  $缓存名字 key
-     * @return mixed
-     */
-    public function createCacheStatistics($value,$score,$key)
-    {
-        $result = $this->cache->zadd($this->StockKey.$key.'::'.$this->onlineEnterpriseId, $score, $value);
-        if ($result == false){
-            return false;
-        }
-        return $result;
-    }
-
-
-    /**
-     * 获取统计
-     * @param $value $字段名 value
-     * @param $key $表名 key
-     * @return mixed
-     */
-    public function getCacheStatistics($value,$key)
-    {
-        $result = $this->cache->ZSCORE($this->StockKey.$key.'::'.$this->onlineEnterpriseId,$value);
-        return $result;
-    }
-
-    /**
-     * 获取key的个数
-     * @param $key //字段名
-     * @return mixed
-     */
-    public function getCacheStatisticsCount($key)
-    {
-        $result = $this->cache->ZCARD($this->StockKey.$key.'::'.$this->onlineEnterpriseId);
-        return $result;
-    }
-
-    /**
-     * 删除统计
-     * @param $key $表名
-     * @return mixed
-     */
-    public function deleteCacheStatistics($key)
-    {
-        $result = $this->cache->del($this->StockKey.$key.'::'.$this->onlineEnterpriseId);
-        return $result;
-    }
-
-    /**
-     * Doc: (des="创建单据当天的序号")
-     * User: XMing
-     * Date: 2020/11/6
-     * Time: 10:24 上午
-     * 	-当天从1开始自增
-     *	-订单号模样:20190604000001
-     * @param int $back 序号回退,如果创建失败,事务回滚可用
-     * @param string $fix
-     * @return string
-     */
-    public function createSerialSn(int $back = 0,string $fix = 'stock'): string
-    {
-        $key = $fix.$this->serialNumKey.'::'.$this->onlineEnterpriseId;
-        $sn = $this->cache->get($key);
-        $snDate = substr($sn,0,8);
-        $snNo = intval(substr($sn,8));
-        $curDate = date('Ymd');
-        if($back == 1){//序号回退
-            if($curDate==$snDate){
-                $snNo = ($snNo > 1 ) ? ( $snNo-1 ) : 1;
-                $sn = $curDate.sprintf("%04d",$snNo);
-            }
-        }else{//序号增加
-            if(empty($sn)){
-                $sn = $curDate.'000001';
-            }else{
-                $snNo = ($curDate==$snDate) ? ($snNo+1) : 1;
-                $sn = $curDate.sprintf("%04d",$snNo);
-            }
-        }
-        $this->cache->set($key,$sn);
-        $sn = self::strInsert($sn,8,'-');
-        return $sn;
-    }
-
-
-    private static function strInsert($str, $index, $sertstr)
-    {
-        return substr($str, 0, $index) . $sertstr . substr($str, $index);
-    }
-
-}

+ 0 - 47
Cache/SupplierCache.Class.php

@@ -1,47 +0,0 @@
-<?php
-/**
- * 供应商缓存
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/12/17
- * Time: 17:00
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class SupplierCache
-{
-    private $cache;
-    protected $SupplierToken = 'SupplierToken';//供应商token
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('default');
-    }
-    /**
-     * 缓存供应商token
-     * @param $enterpriseId
-     * @param $supplierId
-     * @param $token
-     * @return bool
-     */
-    public function setSupplierToken($enterpriseId, $supplierId, $token)
-    {
-        return $this->cache->zadd($this->SupplierToken.'::'.$enterpriseId, $supplierId, $token);
-    }
-
-    /**
-     * 根据token获取供应商id  反解token需要
-     * @param $enterpriseId
-     * @param $token
-     * @return float
-     */
-    public function getSupplierToken($enterpriseId, $token)
-    {
-        return $this->cache->zscore($this->SupplierToken.'::'.$enterpriseId, $token);
-    }
-}

+ 0 - 245
Cache/SysAreaChinaCache.Class.php

@@ -1,245 +0,0 @@
-<?php
-/**
- * 地区缓存
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/5
- * Time: 14:26
- */
-
-namespace JinDouYun\Cache;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-class SysAreaChinaCache
-{
-    private $cache;
-
-    protected $allProvince = 'province';//所有省key
-
-    protected $provinceCodeRelationCityKey = 'provinceCodeRelationCity';//省份下的市key
-
-    protected $cityCodeRelationAreaKey = 'cityCodeRelationArea'; //市下的区县key
-
-    protected $codeRelationNameKey = 'codeRelationName';//code=>name的key
-
-    protected $allKey = 'AreaChinaCache';
-
-    protected $notArea = 'notArea';//缓存所有不存在的地区
-
-    public function __construct($cacheDb = 'mapping')
-    {
-        $this->cache = Factory::cache($cacheDb);
-    }
-
-    /**
-     * 缓存所有省
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function cacheAllProvince($data)
-    {
-        $result = $this->cache->set($this->allProvince, gzcompress(json_encode($data)));
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 获取缓存中的所有省
-     * @return array|mixed
-     */
-    public function getAllProvince()
-    {
-        $result = $this->cache->get($this->allProvince);
-        if (!$result) {
-            return [];
-        }
-        return json_decode(gzuncompress($result));
-    }
-
-    /**
-     * 判断是否有省份的缓存Key
-     * @return boolean
-     */
-    public function isHaveProvinceKey()
-    {
-        $result = $this->cache->has($this->allProvince);
-        return $result;
-    }
-
-    /**
-     * 缓存对应省份下城市
-     * @param $data
-     * @param $code
-     * @return ResultWrapper
-     */
-    public function cacheCityByCode($data, $code)
-    {
-        $result = $this->cache->set($this->provinceCodeRelationCityKey . '::' . $code, gzcompress(json_encode($data)));
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 通过省份code-->市
-     * @param $code
-     * @return array|mixed
-     */
-    public function getCityByProvinceCode($code)
-    {
-        $result = $this->cache->get($this->provinceCodeRelationCityKey . '::' . $code);
-        if (!$result) {
-            return [];
-        }
-        return json_decode(gzuncompress($result));
-    }
-
-    /**
-     * 判断缓存中是否有此key(城市)
-     * @param $code
-     * @return mixed
-     */
-    public function isHaveCityKeyByProvinceCode($code)
-    {
-        $result = $this->cache->has($this->provinceCodeRelationCityKey . '::' . $code);
-        return $result;
-    }
-
-    /**
-     * 缓存市下的区
-     * @param $data
-     * @param $code
-     * @return ResultWrapper
-     */
-    public function cacheAreaByCode($data, $code)
-    {
-        $result = $this->cache->set($this->cityCodeRelationAreaKey . '::' . $code, gzcompress(json_encode($data)));
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-
-    /**
-     * 通过市Code->区
-     * @param $code
-     * @return array|mixed
-     */
-    public function getAreaByCityCode($code)
-    {
-        $result = $this->cache->get($this->cityCodeRelationAreaKey . '::' . $code);
-        if (!$result) {
-            return [];
-        }
-        return json_decode(gzuncompress($result));
-    }
-
-    /**
-     * 判断缓存中是否有此key(区)
-     * @param $code
-     * @return mixed
-     */
-    public function isHaveAreaKeyByCityCode($code)
-    {
-        $result = $this->cache->has($this->cityCodeRelationAreaKey . '::' . $code);
-        return $result;
-    }
-
-    /**
-     * 缓存 name => code
-     * @param $name
-     * @param $code
-     * @return ResultWrapper
-     */
-    public function cacheCodeRelationName($name, $code)
-    {
-        $result = $this->cache->zadd($this->codeRelationNameKey, $code, $name);
-        if ($result) {
-            return ResultWrapper::success('success');
-        } else {
-            return ResultWrapper::fail('error', ErrorCode::$redisWriteError);
-        }
-    }
-
-    /**
-     * 通过code获取集合中的name
-     * @param $code
-     * @return string
-     */
-    public function getNameByCode($code)
-    {
-        $result = $this->cache->zrangebyscore($this->codeRelationNameKey, $code, $code);
-        if (!$result) {
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * 通过name获取code
-     * @param $name
-     * @return int
-     */
-    public function getCodeByName($name): int
-    {
-        $result = $this->cache->zscore($this->codeRelationNameKey, $name);
-        if (!$result) return 0;
-        return $result;
-    }
-
-    /********************************************通过地区名称缓存code******************************************/
-    /**
-     * 保存
-     * @param $key
-     * @param $value
-     * @return int
-     */
-    public function setCache($key, $value)
-    {
-        return $this->cache->hset($this->allKey, $key, $value);
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2021/1/20
-     * Time: 5:25 下午
-     */
-    public function setNotArea($field,$value = 0)
-    {
-        return $this->cache->hset($this->notArea, $field, $value);
-    }
-
-    /**
-     * 获取
-     * @param $key
-     * @return string
-     */
-    public function getCache($key)
-    {
-        $result = $this->cache->hget($this->allKey, $key);
-        if(!$result){
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * 删除
-     * @param $key
-     * @return int
-     */
-    public function delCache($key){
-        return $this->cache->hdel($this->allKey, $key);
-    }
-}

+ 0 - 214
Cache/SystemCache.Class.php

@@ -1,214 +0,0 @@
-<?php
-/**
- * 缓存企业与小程序数据
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/9
- * Time: 16:31
- */
-
-namespace JinDouYun\Cache;
-
-
-use Mall\Framework\Cache\Redis;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-/**
- * Class SystemCache
- * @package JinDouYun\Cache
- */
-class SystemCache
-{
-    private static $enterpriseRelationWxAppIdKey = 'enterpriseRelationWxAppIdMapping';
-
-    private static $paymentKey = 'paymentMapping';//支付配置
-
-    private static $byteDanceSettingKey = 'byteDanceSettingMapping';//字节跳动配置
-
-    private static $printNumKey = 'printNum';//打印次数
-
-    private static $uriRelNameKey = 'uriRelName';//url=>name
-
-    /**
-     * @var Redis
-     */
-    public $cache;
-
-    /**
-     * SystemCache constructor.
-     * @throws \Exception
-     */
-    public function __construct()
-    {
-        $this->cache = Factory::cache('mapping');
-    }
-
-    /**
-     * @param $data
-     * @param $enterpriseId
-     * @return mixed
-     */
-    public function cacheEnterpriseRelationWxAppId($data, $enterpriseId)
-    {
-        $result = $this->cache->hset(self::$enterpriseRelationWxAppIdKey, $enterpriseId, $data);
-        return $result;
-    }
-
-    /**
-     * 获取企业授权的小程序信息
-     * @param $enterpriseId
-     * @return string
-     */
-    public function getAppIdByEnterpriseId($enterpriseId)
-    {
-        $result = $this->cache->hget(self::$enterpriseRelationWxAppIdKey, $enterpriseId);
-        if (!$result) {
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * 缓存支付配置
-     * @param $data
-     * @param $enterpriseId
-     * @return mixed
-     */
-    public function cachePayment($data, $enterpriseId)
-    {
-        if (is_array($data)) {
-            $data = json_encode($data);
-        }
-        $result = $this->cache->hset(self::$paymentKey, $enterpriseId, $data);
-        return $result;
-    }
-
-    /**
-     * @param $enterpriseId
-     * @param string $type
-     * @return array|mixed
-     */
-    public function getPayment($enterpriseId)
-    {
-        $result = $this->cache->hget(self::$paymentKey, $enterpriseId);
-        if (!$result) {
-            return [];
-        }
-        if (!empty($result)) {
-            $result = json_decode($result, true);
-        }
-        return $result;
-    }
-
-    /**
-     * 字节跳动设置
-     * @param string $data
-     * @param int $enterpriseId
-     * @return bool|int
-     */
-    public function cacheByteDanceSetting(string $data, int $enterpriseId)
-    {
-        return $this->cache->hset(self::$byteDanceSettingKey, $enterpriseId, $data);
-    }
-
-    /**
-     * 获取字节跳动设置
-     * @param int $enterpriseId
-     * @return string
-     */
-    public function getByteDanceSetting(int $enterpriseId)
-    {
-        $result = $this->cache->hget(self::$byteDanceSettingKey, $enterpriseId);
-        if (!$result) {
-            return '';
-        }
-        return $result;
-    }
-
-    /**
-     * Doc: (des="获取打印次数")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 11:48 上午
-     * @param int $enterpriseId
-     * @param $no
-     * @return int
-     */
-    public function getObjectPrintNum(int $enterpriseId,$no)
-    {
-        return $this->cache->zscore(self::$printNumKey.'::'.$enterpriseId,$no);
-    }
-
-    /**
-     * Doc: (des="删除打印次数")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 12:05 下午
-     * @param int $enterpriseId
-     * @param $no
-     * @return bool
-     */
-    public function delObjectPrintNum(int $enterpriseId,$no)
-    {
-        return $this->cache->zrem(self::$printNumKey.'::'.$enterpriseId,$no);
-    }
-
-
-
-    /**
-     * Doc: (des="设置打印次数")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 11:49 上午
-     * @param int $enterpriseId
-     * @param $no
-     * @param int $value
-     * @return bool
-     */
-    public function setObjectPrintNum(int $enterpriseId,$no,$value)
-    {
-        return $this->cache->zadd(self::$printNumKey.'::'.$enterpriseId,$value,$no);
-    }
-
-    /**
-     * Doc: (des="混存url与name")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 6:47 下午
-     * @param string $uri
-     * @param string $name
-     */
-    public function setUriRelName(string $uri,string $name)
-    {
-        return $this->cache->hset(self::$uriRelNameKey,strtolower($uri),$name);
-    }
-
-    /**
-     * Doc: (des="删除uri")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 6:51 下午
-     * @param string $uri
-     */
-    public function delUriRelName(string $uri)
-    {
-        return $this->cache->hdel(self::$uriRelNameKey,strtolower($uri));
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/11/14
-     * Time: 6:53 下午
-     * @param string $uri
-     */
-    public function getUriRelName(string $uri)
-    {
-        $name = $this->cache->hget(self::$uriRelNameKey,strtolower($uri));
-        if ($name == false){
-            return '';
-        }
-        return $name;
-    }
-}

+ 0 - 176
Cache/TempSaveCache.Class.php

@@ -1,176 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: wxj
- * Date: 2020-03-24
- * Time: 15:11
- */
-
-namespace JinDouYun\Cache;
-
-use http\Exception;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-
-class TempSaveCache
-{
-    private $cache;
-    protected $vipCardTemporarySaveKey = 'vipCardTempSave';//会员卡暂存
-    protected $goodsTemporarySaveKey = 'goodsTempSave';//商品暂存
-    protected $customerTempSaveKey = 'customerTempSave';//客户暂存
-    protected $shopTempSaveKey = 'shopTempSave';//商铺暂存
-
-    public function __construct()
-    {
-        $this->cache = Factory::cache('default');
-    }
-
-    /**
-     * 会员卡暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveVipCard($enterpriseId, $userCenterId, $data)
-    {
-        if (empty($data)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->vipCardTemporarySaveKey . '::' . $enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取会员卡暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getVipCard($enterpriseId, $userCenterId)
-    {
-        $data = $this->cache->hget($this->vipCardTemporarySaveKey . '::' . $enterpriseId, $userCenterId);
-        return $data ? json_decode($data, true) : [];
-    }
-
-    /**
-     * 删除会员卡暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delVipCard($enterpriseId, $userCenterId)
-    {
-        $result = $this->cache->hdel($this->vipCardTemporarySaveKey . '::' . $enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 客户暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveCustomer($enterpriseId, $userCenterId, $data)
-    {
-        if (empty($data)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->customerTempSaveKey . '::' . $enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取客户暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getCustomer($enterpriseId, $userCenterId)
-    {
-        $data = $this->cache->hget($this->customerTempSaveKey . '::' . $enterpriseId, $userCenterId);
-        return $data ? json_decode($data, true) : [];
-    }
-
-    /**
-     * 删除客户暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delCustomer($enterpriseId, $userCenterId)
-    {
-        $result = $this->cache->hdel($this->customerTempSaveKey . '::' . $enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 商铺暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveShop($enterpriseId, $userCenterId, $data)
-    {
-        if (empty($data)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->shopTempSaveKey . '::' . $enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取商铺暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getShop($enterpriseId, $userCenterId)
-    {
-        $data = $this->cache->hget($this->shopTempSaveKey . '::' . $enterpriseId, $userCenterId);
-        return $data ? json_decode($data, true) : [];
-    }
-
-    /**
-     * 删除商铺暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delShop($enterpriseId, $userCenterId)
-    {
-        $result = $this->cache->hdel($this->shopTempSaveKey . '::' . $enterpriseId, $userCenterId);
-    }
-
-    /**
-     * 商品暂存
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @param $data
-     * @return ResultWrapper
-     */
-    public function saveGoods($enterpriseId, $userCenterId, $data)
-    {
-        if (empty($data)) {
-            return ResultWrapper::fail('要缓存的数据为空', ErrorCode::$paramError);
-        }
-        return $this->cache->hset($this->goodsTemporarySaveKey . '::' . $enterpriseId, $userCenterId, json_encode($data));
-    }
-
-    /**
-     * 获取商品暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     * @return boolean
-     */
-    public function getGoods($enterpriseId, $userCenterId)
-    {
-        $data = $this->cache->hget($this->goodsTemporarySaveKey . '::' . $enterpriseId, $userCenterId);
-        return $data ? json_decode($data, true) : [];
-    }
-
-    /**
-     * 删除商品暂存数据
-     * @param $enterpriseId
-     * @param $userCenterId
-     */
-    public function delGoods($enterpriseId, $userCenterId)
-    {
-        $result = $this->cache->hdel($this->goodsTemporarySaveKey . '::' . $enterpriseId, $userCenterId);
-    }
-}

+ 0 - 415
Config/Config.php

@@ -1,415 +0,0 @@
-<?php
-return [
-    'app_name' => PROJECT_NAME,
-    'app_path' => PROJECT_PATH,
-    // redis
-    'queue'  => [
-        'class'    => 'Jobs\Model\Queue\MRedisTopicQueue',
-        'host'     => '127.0.0.1',
-        'port'     => '6379',
-        'password' => '',
-        'database' =>'' ,
-        ],
-    'swooleServer'=>[
-        'order'=>[
-            "host"=>"127.0.0.1",
-            "port"=>"9501",
-            "ssl"=>true,
-            //没有访问权限,需要放在这个位置
-             'ssl_cert_file' => '/www/server/panel/vhost/cert/apiqnys.liuniukj.com/fullchain.pem',
-             'ssl_key_file' => '/www/server/panel/vhost/cert/apiqnys.liuniukj.com/privkey.pem',
-//            'ssl_cert_file' => '/www/wwwroot/apiqnys.liuniukj.com/swoole_server/cert/apiqnys.liuniukj.com/fullchain.pem',
-//            'ssl_key_file' => '/www/wwwroot/apiqnys.liuniukj.com/swoole_server/cert/apiqnys.liuniukj.com/privkey.pem',
-            
-            
-        ],
-    ],
-    'db' => [
-        'default' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-            'username' => 'root',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devanfei',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'stock' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-            'username' => 'root',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devstock',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'price'   => [
-            'driver'   => 'mysql',
-            'host'     => '127.0.0.1',
-            'port'     => '3306',
-             'username' => 'root',
-            'password' => '0d6047adbbae53c7',
-            'dbname'   => 'qnys_devprice',
-            'prefix'   => 'qianniao',
-            'pconnect' => 0,
-            'charset'  => 'utf8',
-        ],
-        'log' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-             'username' => 'root',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devlog',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'finance' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-            'username' => 'root',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devfinan',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-    ],
-
-    'cache' => [
-        'default' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '0',
-        ],
-        'mapping' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '1',//用于缓存地区
-        ],
-        'user' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '2',
-        ],
-        'finance'    => [
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'new_',
-            'database' => '3',
-        ],
-        'activity'  => [
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'new_',
-            'database' => '5',
-        ],//活动
-        'systask'=>[
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'task_',
-            'database' => '6',
-        ],
-    ],
-
-    'dataResources' => [
-        'stock' => [
-            'host' => '0.0.0.0',
-            'port' => '9501'
-        ]
-    ],
-
-    //49.233.71.60:9200改为47.105.176.4:80
-    'search' => [
-        'goods_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_goods_search',
-            'type' => 'goods',
-        ],
-        'customer_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_customer_search',
-            'type' => 'customer',
-        ],
-        'goods_basic_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_goods_basic_search',
-            'type' => 'goodsBasic',
-        ],
-        'order_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_order_search',
-            'type' => 'order',
-        ],
-        'shop_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_shop_search',
-            'type' => 'shop',
-        ],
-        'login_log' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_login_log',
-            'type' => 'login',
-        ],
-        'logs'                                => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_logs',
-            'type'     => 'logs',
-        ],
-        'inventory_in_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_in_search',
-            'type' => 'inventory_in',
-        ],
-        'priceAdjustmentSheet_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_price_adjustment_sheet_search',
-            'type'     => 'priceAdjustmentSheet',
-        ],
-        'customerPriceAdjustmentSheet_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_customer_price_adjustment_sheet_search',
-            'type'     => 'customerPriceAdjustmentSheet',
-        ],
-        'inventory_out_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_out_search',
-            'type' => 'inventory_out',
-        ],
-        'allocate_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_allocate_search',
-            'type' => 'allocate',
-        ],
-        'stocktaking_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_stocktaking_search',
-            'type' => 'stocktaking',
-        ],
-        'inventory_details_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_details_search',
-            'type' => 'inventory_details',
-        ],
-        'order_out_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_order_out_search',
-            'type' => 'order_out',
-        ],
-        'purchase_details_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '47.105.176.4:80'
-            ],
-            'timeout' => null,
-            'index' => 'dev_purchase_details_search',
-            'type' => 'purchase_details',
-        ],
-        'coupon_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_coupon_search',
-            'type'     => 'coupon',
-        ],
-        'user_coupon_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_user_coupon_search',
-            'type'     => 'user_coupon',
-        ],
-        'activity_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_activity_search',
-            'type'     => 'activity',
-        ],
-        'should_receive_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_should_receive_receipt_search',
-            'type'     => 'should_receive_receipt',
-        ],
-        'should_pay_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_should_pay_receipt_search',
-            'type'     => 'should_pay_receipt',
-        ],
-        'received_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_received_receipt_search',
-            'type'     => 'received_receipt',
-        ],
-        'paid_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_paid_receipt_search',
-            'type'     => 'paid_receipt',
-        ],
-        'inventory_batch_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '47.105.176.4:80'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_inventory_batch_search',
-            'type'     => 'inventory_batch',
-        ],
-
-    ],
-
-    'weixin' => [
-        'app'         => [
-            'appid' => '',
-        ],
-        'miniprogram' => [
-            'appid'     => '',
-            'appSecret' => '',
-        ],
-        'offiaccount' => [
-            'appid'     => '',
-            'appSecret' => '',
-        ],
-        'oplatform'   => [ // 开放平台
-            'appid'          => '',
-            'appSecret'      => '',
-            'token'          => '',
-            'encodingAesKey' => '',
-        ],
-        'pay'         => [
-            'mch_id'        => '',
-            'apiPartnerKey' => ''
-        ],
-         'service_pay' => [
-            'mch_id' => '', 
-            'apiPartnerKey' => ''
-        ] 
-    ],
-
-    'sms' => [
-        'registerCodeKey' => '',
-        'SmsSdkAppid' => '',
-    ],
-
-    'outsideSystem' => [
-        'wms' => '',
-        'oms' => ''
-    ],
-    'keruyun' => [
-        'appKey' => '',
-        'shopIdenty' => '',
-        'version' => '1.0',
-        'secretKey' => '',
-    ],
-    'kuaidi100'     => [
-        'customer' => '',
-        'key'      => ''
-    ],
-    'qiniu' => [
-        'accessKey' => 'BLlI0KPOS-oW4XApVaP72x-LOiKbqyC6qhRoEp3p',
-        'secretKey' => 'juhP3Z2-4ikUS2OifOsv9B9IHnLS24s_TGsg-vPD'
-    ]
-];

+ 0 - 417
Config/Config_local.php

@@ -1,417 +0,0 @@
-<?php
-return [
-    'app_name' => PROJECT_NAME,
-    'app_path' => PROJECT_PATH,
-    // redis
-    'queue'  => [
-        'class'    => 'Jobs\Model\Queue\MRedisTopicQueue',
-        'host'     => '127.0.0.1',
-        'port'     => '6379',
-        'password' => '',
-        'database' =>'' ,
-        ],
-    'swooleServer'=>[
-        'order'=>[
-            "host"=>"127.0.0.1",
-            "port"=>"9501",
-            "ssl"=>false,
-            'ssl_cert_file' => '/www/server/panel/vhost/cert/apiqnys.liuniukj.com/fullchain.pem',
-            'ssl_key_file' => '/www/server/panel/vhost/cert/apiqnys.liuniukj.com/privkey.pem',
-        ],
-    ],
-    'db' => [
-        'default' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-//            'username' => 'root',
-            'username' => 'rootdefault',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devanfei',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'stock' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-//            'username' => 'root',
-            'username' => 'rootstock',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devstock',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'price'   => [
-            'driver'   => 'mysql',
-            'host'     => '127.0.0.1',
-            'port'     => '3306',
-//             'username' => 'root',
-            'username' => 'rootprice',
-            'password' => '0d6047adbbae53c7',
-            'dbname'   => 'qnys_devprice',
-            'prefix'   => 'qianniao',
-            'pconnect' => 0,
-            'charset'  => 'utf8',
-        ],
-        'log' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-//             'username' => 'root',
-            'username' => 'rootlog',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devlog',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-        'finance' => [
-            'driver' => 'mysql',
-            'host' => '127.0.0.1',
-            'port' => '3306',
-//            'username' => 'root',
-            'username' => 'rootfinance',
-            'password' => '0d6047adbbae53c7',
-            'dbname' => 'qnys_devfinan',
-            'prefix' => 'qianniao',
-            'pconnect' => 0,
-            'charset' => 'utf8',
-        ],
-    ],
-
-    'cache' => [
-        'default' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '0',
-        ],
-        'mapping' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '1',//用于缓存地区
-        ],
-        'user' => [
-            'storage' => 'redis',
-            'host' => '127.0.0.1',
-            'port' => '6379',
-            'auth' => '',
-            'prefix' => 'new_',
-            'database' => '2',
-        ],
-        'finance'    => [
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'new_',
-            'database' => '3',
-        ],
-        'activity'  => [
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'new_',
-            'database' => '5',
-        ],//活动
-        
-        'systask'=>[
-            'storage'  => 'redis',
-            'host'     => '127.0.0.1',
-            'port'     => '6379',
-            'auth'     => '',
-            'prefix'   => 'task_',
-            'database' => '6',
-        ],
-    ],
-
-    'dataResources' => [
-        'stock' => [
-//            'host' => '127.0.0.1',
-            'host' => '0.0.0.0',
-            'port' => '9501'
-        ]
-    ],
-
-    //搜索引擎配置 影子测试:49.233.71.60:9200改为127.0.0.1:443测试【暂时没用】
-    'search' => [
-        'goods_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_goods_search',
-            'type' => 'goods',
-        ],
-        'customer_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_customer_search',
-            'type' => 'customer',
-        ],
-        'goods_basic_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_goods_basic_search',
-            'type' => 'goodsBasic',
-        ],
-        'order_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_order_search',
-            'type' => 'order',
-        ],
-        'shop_search' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_shop_search',
-            'type' => 'shop',
-        ],
-        'login_log' =>[
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_login_log',
-            'type' => 'login',
-        ],
-        'logs'                                => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_logs',
-            'type'     => 'logs',
-        ],
-        'inventory_in_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_in_search',
-            'type' => 'inventory_in',
-        ],
-        'priceAdjustmentSheet_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_price_adjustment_sheet_search',
-            'type'     => 'priceAdjustmentSheet',
-        ],
-        'customerPriceAdjustmentSheet_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_customer_price_adjustment_sheet_search',
-            'type'     => 'customerPriceAdjustmentSheet',
-        ],
-        'inventory_out_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_out_search',
-            'type' => 'inventory_out',
-        ],
-        'allocate_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_allocate_search',
-            'type' => 'allocate',
-        ],
-        'stocktaking_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_stocktaking_search',
-            'type' => 'stocktaking',
-        ],
-        'inventory_details_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_inventory_details_search',
-            'type' => 'inventory_details',
-        ],
-        'order_out_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_order_out_search',
-            'type' => 'order_out',
-        ],
-        'purchase_details_search' => [
-            'protocol' => 'http',
-            'servers' => [
-                '127.0.0.1:443'
-            ],
-            'timeout' => null,
-            'index' => 'dev_purchase_details_search',
-            'type' => 'purchase_details',
-        ],
-        'coupon_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_coupon_search',
-            'type'     => 'coupon',
-        ],
-        'user_coupon_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_user_coupon_search',
-            'type'     => 'user_coupon',
-        ],
-        'activity_search' => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_activity_search',
-            'type'     => 'activity',
-        ],
-        'should_receive_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_should_receive_receipt_search',
-            'type'     => 'should_receive_receipt',
-        ],
-        'should_pay_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_should_pay_receipt_search',
-            'type'     => 'should_pay_receipt',
-        ],
-        'received_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_received_receipt_search',
-            'type'     => 'received_receipt',
-        ],
-        'paid_receipt_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_paid_receipt_search',
-            'type'     => 'paid_receipt',
-        ],
-        'inventory_batch_search'                  => [
-            'protocol' => 'http',
-            'servers'  => [
-                '127.0.0.1:443'
-            ],
-            'timeout'  => null,
-            'index'    => 'dev_inventory_batch_search',
-            'type'     => 'inventory_batch',
-        ],
-
-    ],
-
-    'weixin' => [
-        'app'         => [
-            'appid' => '',
-        ],
-        'miniprogram' => [
-            'appid'     => '',
-            'appSecret' => '',
-        ],
-        'offiaccount' => [
-            'appid'     => '',
-            'appSecret' => '',
-        ],
-        'oplatform'   => [ // 开放平台
-            'appid'          => '',
-            'appSecret'      => '',
-            'token'          => '',
-            'encodingAesKey' => '',
-        ],
-        'pay'         => [
-            'mch_id'        => '',
-            'apiPartnerKey' => ''
-        ],
-         'service_pay' => [
-            'mch_id' => '', 
-            'apiPartnerKey' => ''
-        ] 
-    ],
-
-    'sms' => [
-        'registerCodeKey' => '',
-        'SmsSdkAppid' => '',
-    ],
-
-    'outsideSystem' => [
-        'wms' => '',
-        'oms' => ''
-    ],
-    'keruyun' => [
-        'appKey' => '',
-        'shopIdenty' => '',
-        'version' => '1.0',
-        'secretKey' => '',
-    ],
-    'kuaidi100'     => [
-        'customer' => '',
-        'key'      => ''
-    ],
-    'qiniu' => [
-        'accessKey' => 'BLlI0KPOS-oW4XApVaP72x-LOiKbqyC6qhRoEp3p',
-        'secretKey' => 'juhP3Z2-4ikUS2OifOsv9B9IHnLS24s_TGsg-vPD'
-    ]
-];

+ 0 - 346
Controller/Agent/Agents.Class.php

@@ -1,346 +0,0 @@
-<?php
-/**
- * 代理商
- * Created by PhpStorm.
- * User: user
- * Date: 2021/6/24
- * Time: 12:00
- */
-
-namespace JinDouYun\Controller\Agent;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Model\Agent\MAgents;
-use JinDouYun\Model\Manage\MEnterprise;
-use JinDouYun\Model\Manage\MWxTemplate;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\UserCenter\MUserCenterRegister;
-
-class Agents extends BaseController
-{
-    public $objMAgents;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMAgents = new MAgents();
-    }
-
-    /**
-     * 添加,编辑接收公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $AgentFieldData = [
-            'workName'    => isset($params['workName']) ? $params['workName'] : '',//公司名称
-            'contact' => isset($params['contact']) ? $params['contact'] : '',//联系人
-            'address'    => isset($params['address']) ? $params['address'] : '',//公司地址
-            'initiateStatus' => isset($params['initiateStatus']) ? $params['initiateStatus'] : '',//启用状态(0禁用 1启用)
-        ];
-        //判断必传
-        foreach ($AgentFieldData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $AgentFieldData['contact'] = json_encode($AgentFieldData['contact']);//联系人存json
-        return $AgentFieldData;
-    }
-
-    /**
-     * 添加代理商数据
-     */
-    public function addAgent()
-    {
-        $agentData = $this->commonFieldFilter();//接收公共字段
-
-        $result = $this->objMAgents->addAgent($agentData);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 编辑代理商数据
-     */
-    public function editAgent()
-    {
-        $id = $this->request->param('id');
-        if (empty($id)) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $agentData = $this->commonFieldFilter();//接收公共字段
-        $agentData['id'] = $id;
-        $result = $this->objMAgents->editAgent($agentData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 删除代理商数据
-     */
-    public function deleteAgent()
-    {
-        $id = $this->request->param('id');
-        if(empty($id)){
-            parent::sendOutput('id为空', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMAgents->deleteAgent($id);//软删除
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-
-    /**
-     * 查询代理商
-     */
-    public function getAllAgent()
-    {
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-        $selectParams = [
-            'limit'  => $pageSize,
-            'offset' => $offset,
-        ];
-
-        $result = $this->objMAgents->getAllAgent($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * oem代理商信息设置
-     */
-    public function oemSystemSet()
-    {
-        $params = $this->request->getRawJson();
-
-        if( empty($params['setData']) or empty($params['type'])){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-        $result = $this->objMAgents->oemSystemSet($params,$this->onlineEnterpriseId);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取所有企业列表
-     * @throws \Exception
-     */
-    public function getAllEnterprise()
-    {
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-
-        $selectParams = [
-            'oemId' =>$this->onlineEnterpriseId,
-            'limit'  => $pageSize,
-            'offset' => $offset,
-        ];
-        
-        $objMEnterprise = new MEnterprise();
-        $result = $objMEnterprise->getAllEnterprise($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['enterpriseData'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 根据企业id获取oem企业
-     */
-    public function getOemInfo()
-    {
-        $result = $this->objMAgents->getOemInfo(['enterpriseId'=>$this->onlineEnterpriseId]);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData()[0]);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-
-    }
-
-    /**
-     * 用户中心添加 / oem用户注册
-     * @throws \Exception
-     */
-    public function addOemUserCenter()
-    {
-
-        //接收参数
-        $params = $this->request->getRawJson();
-        //映射参数
-        $UserCenterData = [
-            "mobile" => isset($params['mobile']) ? $params['mobile'] : '',
-            "password" => isset($params['password']) ? $params['password'] : '',
-        ];
-
-        //校验参数
-        foreach ($UserCenterData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        //校验手机号格式
-        $this->checkMobile($UserCenterData['mobile']);
-        //格式化密码
-        $UserCenterData['password'] = password_hash($UserCenterData['password'], PASSWORD_DEFAULT );
-
-        //来源标识
-        $UserCenterData['source'] = StatusCode::$delete;
-        $UserCenterData['createTime'] = time();
-        $UserCenterData['updateTime'] = time();
-        $objMUserCenterRegister = new MUserCenterRegister();
-        $result = $objMUserCenterRegister->addUserCenter($UserCenterData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * oem企业微信模版列表
-     * @throws \Exception
-     */
-    public function getOemWxTemplateAll()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset(isset($params['page']) ? $params['page'] : 1, isset($params['pageSize']) ? $params['pageSize'] : 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $selectParams['oemId'] = $this->onlineEnterpriseId;
-
-        $objMWxTemplate  = new MWxTemplate();
-        $result = $objMWxTemplate->getAll($selectParams);
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => isset($params['page']) ? $params['page'] : 1,
-                'pageSize'  => isset($params['pageSize']) ? $params['pageSize'] : 10,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-
-    }
-
-    /**
-     * 查询oem套餐
-     */
-    public function getAllMeal()
-    {
-        $result = $this->objMAgents->getAllMeal();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * oem续费
-     */
-    public function renew()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $details = [
-            'enterpriseId' => getArrayItem($params,'enterpriseId',0),
-            'enterpriseName' => getArrayItem($params,'enterpriseName',''),
-            'mobile' => getArrayItem($params,'mobile',0),
-            'money' => getArrayItem($params,'money',0),
-            'mealId' => getArrayItem($params,'mealId',0),
-        ];
-
-        foreach ($details as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $result = $this->objMAgents->renew($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 消费记录列表
-     */
-    public function getAllRenew()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['enterpriseId'] = getArrayItem($params,'enterpriseId',0);
-        $params['mobile'] = getArrayItem($params,'mobile',"");
-        $params['mealId'] = getArrayItem($params,'mealId',0);
-
-        $returnData = $this->objMAgents->getAllRenew($params);
-
-        if ($returnData->isSuccess()) {
-            $returnData = $returnData->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
-        }
-    }
-
-}

+ 0 - 346
Controller/Api/System.Class.php

@@ -1,346 +0,0 @@
-<?php
-/**
- * 代理商
- * Created by PhpStorm.
- * User: user
- * Date: 2021/6/24
- * Time: 12:00
- */
-
-namespace JinDouYun\Controller\Api;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Model\Agent\MAgents;
-use JinDouYun\Model\Manage\MEnterprise;
-use JinDouYun\Model\Manage\MWxTemplate;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\UserCenter\MUserCenterRegister;
-
-class System extends BaseController
-{
-    public $objMAgents;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMAgents = new MAgents();
-    }
-
-    /**
-     * 添加,编辑接收公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $AgentFieldData = [
-            'workName'    => isset($params['workName']) ? $params['workName'] : '',//公司名称
-            'contact' => isset($params['contact']) ? $params['contact'] : '',//联系人
-            'address'    => isset($params['address']) ? $params['address'] : '',//公司地址
-            'initiateStatus' => isset($params['initiateStatus']) ? $params['initiateStatus'] : '',//启用状态(0禁用 1启用)
-        ];
-        //判断必传
-        foreach ($AgentFieldData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $AgentFieldData['contact'] = json_encode($AgentFieldData['contact']);//联系人存json
-        return $AgentFieldData;
-    }
-
-    /**
-     * 添加代理商数据
-     */
-    public function addAgent()
-    {
-        $agentData = $this->commonFieldFilter();//接收公共字段
-
-        $result = $this->objMAgents->addAgent($agentData);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 编辑代理商数据
-     */
-    public function editAgent()
-    {
-        $id = $this->request->param('id');
-        if (empty($id)) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $agentData = $this->commonFieldFilter();//接收公共字段
-        $agentData['id'] = $id;
-        $result = $this->objMAgents->editAgent($agentData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 删除代理商数据
-     */
-    public function deleteAgent()
-    {
-        $id = $this->request->param('id');
-        if(empty($id)){
-            parent::sendOutput('id为空', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMAgents->deleteAgent($id);//软删除
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-
-    /**
-     * 查询代理商
-     */
-    public function getAllAgent()
-    {
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-        $selectParams = [
-            'limit'  => $pageSize,
-            'offset' => $offset,
-        ];
-
-        $result = $this->objMAgents->getAllAgent($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * oem代理商信息设置
-     */
-    public function oemSystemSet()
-    {
-        $params = $this->request->getRawJson();
-
-        if( empty($params['setData']) or empty($params['type'])){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-        $result = $this->objMAgents->oemSystemSet($params,$this->onlineEnterpriseId);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取所有企业列表
-     * @throws \Exception
-     */
-    public function getAllEnterprise()
-    {
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-
-        $selectParams = [
-            'oemId' =>$this->onlineEnterpriseId,
-            'limit'  => $pageSize,
-            'offset' => $offset,
-        ];
-
-        $objMEnterprise = new MEnterprise();
-        $result = $objMEnterprise->getAllEnterprise($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['enterpriseData'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 根据企业id获取oem企业
-     */
-    public function getOemInfo()
-    {
-        $result = $this->objMAgents->getOemInfo(['enterpriseId'=>$this->onlineEnterpriseId]);
-
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData()[0]);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-
-    }
-
-    /**
-     * 用户中心添加 / oem用户注册
-     * @throws \Exception
-     */
-    public function addOemUserCenter()
-    {
-
-        //接收参数
-        $params = $this->request->getRawJson();
-        //映射参数
-        $UserCenterData = [
-            "mobile" => isset($params['mobile']) ? $params['mobile'] : '',
-            "password" => isset($params['password']) ? $params['password'] : '',
-        ];
-
-        //校验参数
-        foreach ($UserCenterData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        //校验手机号格式
-        $this->checkMobile($UserCenterData['mobile']);
-        //格式化密码
-        $UserCenterData['password'] = password_hash($UserCenterData['password'], PASSWORD_DEFAULT );
-
-        //来源标识
-        $UserCenterData['source'] = StatusCode::$delete;
-        $UserCenterData['createTime'] = time();
-        $UserCenterData['updateTime'] = time();
-        $objMUserCenterRegister = new MUserCenterRegister();
-        $result = $objMUserCenterRegister->addUserCenter($UserCenterData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * oem企业微信模版列表
-     * @throws \Exception
-     */
-    public function getOemWxTemplateAll()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset(isset($params['page']) ? $params['page'] : 1, isset($params['pageSize']) ? $params['pageSize'] : 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $selectParams['oemId'] = $this->onlineEnterpriseId;
-
-        $objMWxTemplate  = new MWxTemplate();
-        $result = $objMWxTemplate->getAll($selectParams);
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => isset($params['page']) ? $params['page'] : 1,
-                'pageSize'  => isset($params['pageSize']) ? $params['pageSize'] : 10,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-
-    }
-
-    /**
-     * 查询oem套餐
-     */
-    public function getAllMeal()
-    {
-        $result = $this->objMAgents->getAllMeal();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * oem续费
-     */
-    public function renew()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $details = [
-            'enterpriseId' => getArrayItem($params,'enterpriseId',0),
-            'enterpriseName' => getArrayItem($params,'enterpriseName',''),
-            'mobile' => getArrayItem($params,'mobile',0),
-            'money' => getArrayItem($params,'money',0),
-            'mealId' => getArrayItem($params,'mealId',0),
-        ];
-
-        foreach ($details as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $result = $this->objMAgents->renew($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 消费记录列表
-     */
-    public function getAllRenew()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['enterpriseId'] = getArrayItem($params,'enterpriseId',0);
-        $params['mobile'] = getArrayItem($params,'mobile',"");
-        $params['mealId'] = getArrayItem($params,'mealId',0);
-
-        $returnData = $this->objMAgents->getAllRenew($params);
-
-        if ($returnData->isSuccess()) {
-            $returnData = $returnData->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
-        }
-    }
-
-}

+ 0 - 542
Controller/BaseController.Class.php

@@ -1,542 +0,0 @@
-<?php
-namespace JinDouYun\Controller;
-
-use AlibabaCloud\SDK\Dingtalk\Vworkflow_1_0\Models\GetProcessConfigResponseBody\result\handSignConf;
-use JinDouYun\Cache\ShopCache;
-use JinDouYun\Cache\SupplierCache;
-use JinDouYun\Dao\Enterprise\DEnterprise;
-use JinDouYun\Dao\Shop\DShopKey;
-use JinDouYun\Model\Enterprise\MEnterprise;
-use JinDouYun\Model\System\MBasicSetup;
-use JinDouYun\Model\System\MModule;
-use JinDouYun\Model\Shop\MShop;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\Jwt;
-use Mall\Framework\Core\ErrorCode;
-
-use JinDouYun\Cache\EnterpriseCache;
-use JinDouYun\Cache\RoleAclCache;
-use JinDouYun\Cache\SysAreaChinaCache;
-
-use JinDouYun\Model\SysAreaChina\MSysAreaChina;
-
-class BaseController
-{
-
-    /** @var  \Mall\Framework\Core\Request $request */
-    protected $request;
-
-    /** @var  \Mall\Framework\Core\Cache $cache */
-    protected $cache;
-
-    /**
-     * @var int
-     */
-    protected $onlineUserId;
-
-    /**
-     * @var int
-     */
-    protected $onlineEnterpriseId;
-
-    /**
-     * @var string
-     */
-    protected $authorization;
-
-    /**
-     * @var string
-     */
-    protected $token;
-
-    /**
-     * @var string
-     */
-    protected $areaCode;
-
-    /**
-     * @var string 店铺token
-     */
-    private $shopToken = '';
-
-    /**
-     * @var int 供应商id
-     */
-    protected $supplierId = null;//TODO
-
-    /**
-     * @var string
-     */
-    protected $supplierToken = '';
-
-    /**
-     * @var int
-     */
-    protected $shopId = 0;
-
-    /**
-     * BaseController constructor.
-     * @param bool $isCheckAcl
-     * @param false $isMustLogin
-     * @param bool $checkToken
-     * @param false $getAreaCode
-     * @param bool $checkShopToken
-     * @param bool $checkSupplierToken
-     */
-    public function __construct(
-        $isCheckAcl = true,
-        $isMustLogin = false,
-        $checkToken = true,
-        $getAreaCode=false,
-        $checkShopToken = true,
-        $checkSupplierToken = true
-    ){
-        $this->request = Factory::request();
-        //$this->cache = Factory::cache();
-
-        if($isMustLogin){
-            self::getUserIdByAuthorization();
-        }
-
-        if($checkToken){
-            self::getEnterpriseIdByToken();
-        }
-
-        if($isCheckAcl){
-//            self::checkAcl();
-        }
-
-        if ($getAreaCode) {
-            self::getAreaCode();
-        }
-        if ($checkShopToken){
-            self::getShopIdByShopToken();
-        }
-        if ($checkSupplierToken){
-            self::getSupplierIdBySupplierToken();
-        }
-    }
-
-    /**
-     * #777每请求一次接口刷新一次Authorization 没有请求接口2小时 Authorization过期 需要重新登录
-     * 根据Authorization获取userCenterId
-     *
-     * return int
-     */
-    public function getUserIdByAuthorization()
-    {
-        $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
-        if(empty($authorization)) {
-            $this->sendOutput('未登录', ErrorCode::$notAllowToken);
-        }
-
-        try {
-            $jwt_data = JWT::decode($authorization, SITE_SECRET, array('HS256'));
-
-            if (empty($jwt_data) || $jwt_data->expireTime < time()) {
-//                $this->sendOutput('登陆用户过期', ErrorCode::$loginedexpire);
-                /*
-                    $referurl = $this->request->getServerParam('REQUEST_URI');
-                    $loginUrl = '?m=member&c=login&a=login&referurl=' . DOMAIN_PROJECT . $referurl;
-                    header('Location:' . $loginUrl);
-                */
-            }
-            $this->onlineUserId = intval($jwt_data->uid);
-            $this->authorization = $authorization;
-
-        } catch (\Exception $e) {
-            $this->sendOutput('无效的Authorization', ErrorCode::$notAllowToken);
-        }
-    }
-
-    /**
-     * Doc: (des="根据SHOP_TOKEN获取店铺id")
-     * User: XMing
-     * Date: 2020/12/2
-     * Time: 10:03 上午
-     */
-    public function getShopIdByShopToken($Token = '')
-    {
-        $shopToken = $this->request->getServerParam('HTTP_SHOP_TOKEN');
-        if (empty($shopToken)){
-            $shopToken = $Token;
-            if (empty($shopToken)){
-                return;
-            }
-        }
-
-        $this->shopToken = $shopToken;
-        $objShopCache = new ShopCache();
-        if (empty($this->onlineEnterpriseId)){
-            $token = $this->request->getServerParam('HTTP_TOKEN');
-            $this->token = $token;
-            if (!empty($this->token)){
-                $objEnterpriseCache = new EnterpriseCache();
-                $this->onlineEnterpriseId = intval($objEnterpriseCache->getEnterpriseIdByToken($token));
-            }
-        }
-        $objMShop=new MShop($this->onlineEnterpriseId);
-        $this->shopId=$objMShop->getShopid($this->onlineEnterpriseId,$this->shopToken)[0]['id'];
-      ;
-
-//        $this->shopId = intval($objShopCache->getShopToken(10,$this->shopToken));
-        if (empty($this->shopId)){
-            $this->sendOutput('店铺不存在',ErrorCode::$notAllowAccess);
-        }
-    }
-
-    public function getSupplierIdBySupplierToken()
-    {
-        $supplierToken = $this->request->getServerParam('HTTP_SUPPLIER_TOKEN');
-        if (empty($supplierToken)){
-            return;
-        }
-        $this->supplierToken = $supplierToken;
-        $objSupplierCache = new SupplierCache();
-        $this->supplierId = intval($objSupplierCache->getSupplierToken($this->onlineEnterpriseId,$this->supplierToken));
-        if (empty($this->supplierId)){
-            $this->sendOutput('供应商不存在',ErrorCode::$notAllowAccess);
-        }
-    }
-
-    /**
-     * 根据企业token获取企业id enterpriseId
-     * return int
-     * @param bool $checkExists
-     */
-    public function getEnterpriseIdByToken($checkExists = true)
-    {
-        $token = $this->request->getServerParam('HTTP_TOKEN');
-        $this->token = $token;
-        if(!$this->token && $checkExists) {
-            $this->sendOutput('token为空', ErrorCode::$notAllowToken);
-        }
-        // 先从Cache中根据token找id
-        $objEnterpriseCache = new EnterpriseCache();
-        $this->onlineEnterpriseId = intval($objEnterpriseCache->getEnterpriseIdByToken($token));
-       // 如果没有就从数据库中找id
-        if(empty($this->onlineEnterpriseId)){
-          $objMEnterprise = new MEnterprise();
-          $enterpriseId = $objMEnterprise->getEnterpriseIdByToken($token);
-          if(!$enterpriseId->isSuccess()){
-              $this->sendOutput($enterpriseId->getData(), $enterpriseId->getErrorCode());
-          }
-          $enterpriseId = $enterpriseId->getData();
-          $this->onlineEnterpriseId = intval($enterpriseId);
-        }
-
-        // 以上都没有则企业不存在
-        if( empty($this->onlineEnterpriseId) && $checkExists){
-            $this->sendOutput('当前企业不存在', ErrorCode::$notAllowAccess);
-        }
-
-        $objEnterpriseCache->enterpriseIdAndTokenCache($this->onlineEnterpriseId, $token);
-    }
-
-    public function getAreaCode() {
-        $location = $this->request->getServerParam('HTTP_LOCATION');
-        if (empty($location)) {
-            $this->areaCode = '';
-            return;
-        }
-
-        $areaArr = json_decode(base64_decode($location),true);
-        if (is_string($areaArr)) {
-            $areaArr = json_decode($areaArr,true);
-        }
-        if(empty($areaArr)){
-            $areaArr = [
-                'provinceName' => '陕西省',
-                'cityName'     => '西安市',
-                'districtName' => '莲湖区'
-            ];
-        }
-        foreach($areaArr as &$value){
-            if(empty($value)){
-                $value = '';
-            }
-        }
-
-        switch($areaArr['cityName']){
-            case '北京市':
-                $areaArr['provinceName'] = '北京市';
-                break;
-            case '重庆市':
-                $areaArr['provinceName'] = '重庆市';
-                break;
-            case '天津市':
-                $areaArr['provinceName'] = '天津市';
-                break;
-            case '上海市':
-                $areaArr['provinceName'] = '上海市';
-                break;
-        }
-//        V($areaArr);
-
-        $this->areaCode = '';
-        $objMSysAreaChina = new MSysAreaChina();
-        $modelResult = $objMSysAreaChina->getCodeByName($areaArr);
-        if(!$modelResult->isSuccess()){
-            $this->sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $areaData = $modelResult->getData();
-        foreach($areaData as $value){
-            $this->areaCode = !empty($this->areaCode) ? $this->areaCode.'-'.$value : $this->areaCode.$value;
-        }
-    }
-    /**
-     * 校验权限,当前登录用户是否可操作当前企业
-     */
-    public function checkAcl() {
-        if(!$this->onlineUserId) {
-            $this->sendOutput('请登录', ErrorCode::$notAllowToken);
-        }
-
-        if(!$this->onlineEnterpriseId) {
-            $this->sendOutput('请选择企业', ErrorCode::$notAllowToken);
-        }
-
-        //获取用户与企业的关联关系
-        $objEnterpriseCache = new EnterpriseCache();
-        $enterpriseIds = $objEnterpriseCache->getUserCenterIdAndEnterpriseIds($this->onlineUserId);
-
-        //用户与企业不存在关联,则无权限
-        if(!isset($enterpriseIds[$this->onlineEnterpriseId])){
-            $this->sendOutput('没有权限操作', ErrorCode::$notAllowAccess);
-        }
-
-        //如果是创建者,则超级管理员,无限权限
-        if($enterpriseIds[$this->onlineEnterpriseId] == StatusCode::$roleType['admin']) {
-            return true;
-        }
-
-        //员工,获取其在企业所属的角色组id
-        $objRoleAclCache = new RoleAclCache();
-        $roleId = $objRoleAclCache->getRoleIdOfStaff($this->onlineEnterpriseId, $this->onlineUserId);
-        if(!$roleId){
-            $this->sendOutput('请联系管理员获取角色', ErrorCode::$notAllowAccess);
-        }
-
-        //查询是否为超级管理员
-        $cacheResult = $objRoleAclCache->getAdministrator($this->onlineEnterpriseId, $roleId);
-        if($cacheResult){
-            //是超级管理员
-            return true;
-        }
-
-        self::accessCheck($roleId);
-    }
-
-    /**
-     * 系统核心权限控制部分
-     * @param array $aclList
-     * @return bool
-     */
-    public function accessCheck($roleId)
-    {
-        $moduleName = strtolower($this->request->getModule());
-        $controllerName = strtolower($this->request->param('c'));
-        $actionName = strtolower($this->request->getAction());
-
-        if (!$moduleName || !$controllerName || !$actionName) {
-            self::sendOutput('非法的请求', ErrorCode::$notAllowAccess);
-        }
-
-        $accessUrl = $moduleName . DS . $controllerName . DS . $actionName;
-        //过滤是否验证权限
-        $objRoleAclCache = new RoleAclCache();
-        $result = $objRoleAclCache->getAuthority($accessUrl);
-        if(!$result){
-            return true;
-        }
-        //搜索的直接放行
-        if(strpos($actionName,'search') !== false) {
-            return true;
-        }
-        $cacheResult = $objRoleAclCache->getAuthorityBindRole($this->onlineEnterpriseId, $roleId, $accessUrl);
-        if(!$cacheResult){
-            $objMModule = new MModule();
-            $moduleName =(string) $objMModule->getModuleNameByUri($accessUrl);
-            self::sendOutput('没有权限操作,'.$moduleName, ErrorCode::$notHaveAclAccess);
-        }
-        return true;
-    }
-
-    /**
-     * 项目全局返回json格式
-     * @param $data
-     * @param int $errorcode
-     * @param array $pageData
-     */
-    public function sendOutput($data, $errorcode = 0, $pageData = [])
-    {
-        $errorcode = intval($errorcode);
-
-        if ($errorcode) {
-            $sendMessage = [
-                'state' => false,
-                'data' => $data,
-                'errorcode' => $errorcode
-            ];
-        } else {
-            $sendMessage = [
-                'state' => true,
-                'data' => $data,
-                'errorcode' => $errorcode
-            ];
-        }
-        $sendMessage = array_merge($sendMessage, $pageData);
-
-        if($sendMessage['errorcode'] == ErrorCode::$dberror){
-            $moduleName = strtolower($this->request->getModule());
-            $controllerName = strtolower($this->request->param('c'));
-            $actionName = strtolower($this->request->getAction());
-            $accessUrl = $moduleName . DS . $controllerName . DS . $actionName;
-//            file_put_contents('../apps/logs/sqlerror.log', date('Y-m-d H:i:s').'-'.$accessUrl.'-'.var_export($sendMessage['data'], true) . PHP_EOL, FILE_APPEND);
-        }
-
-        if(empty($sendMessage['data']) && !isset($sendMessage['pageTotal'])){
-            exit(json_encode($sendMessage, JSON_UNESCAPED_UNICODE|JSON_FORCE_OBJECT));
-        }
-        exit(json_encode($sendMessage, JSON_UNESCAPED_UNICODE));
-    }
-
-    /**
-     * 检查手机号格式
-     * @param $mobile
-     */
-    public function checkMobile($mobile){
-        $checkMobile = isMobile($mobile);
-        if(!$checkMobile){
-            self::sendOutput('手机格式不正确', ErrorCode::$paramError);
-        }
-    }
-
-
-
-    public function pr($var, $int = '')
-    {
-        $template = PHP_SAPI !== 'cli' ? '<pre>%s</pre>' : "\n%s\n";
-        printf($template, print_r($var, true));
-        exit($int);
-
-    }
-
-    /**
-     *获取AccessToken
-     * @return bool|string
-     */
-    public function AccessToken()
-    {
-        $this->shopKey = new DShopKey('default');
-
-        $this->shopKey->setTable($this->shopKey->get_Table().'_'.$this->onlineEnterpriseId);
-
-        $data = $this->shopKey->get(['shop_id' => $this->shopId]);
-        $data = [
-            'corpid' => $data['corpid'],
-            'ssoSecret' => $data['ssoSecred']
-        ];
-        $res = $this->post_json('https://api.dingtalk.com/v1.0/oauth2/ssoAccessToken', json_encode($data));
-        $res = json_decode($res);
-        return $res->access_token;
-    }
-
-    /**
-     * 获取免登入凭证
-     * @return bool|string
-     */
-    public function voucher($shopId = '', $EnterpriseId = '')
-    {
-        $this->shopKey = new DShopKey('default');
-
-        $onlineEnterpriseId = $this->onlineEnterpriseId ? $this->onlineEnterpriseId : $EnterpriseId;
-        $shopId = $this->shopId ? $this->shopId : $shopId;
-
-
-        $basic = new MBasicSetup($onlineEnterpriseId);
-        $data = $basic->getBasicSetup($onlineEnterpriseId)->getData();
-//        $data = $this->shopKey->get(['enterprise_id' => $onlineEnterpriseId]);
-
-        if (isset($data['basicData']['appKey']) and isset($data['basicData']['appSecret'])){
-            if (empty($data['basicData']['appKey']) || empty($data['basicData']['appSecret'])){
-                self::sendOutput('请完善配置钉钉apikey', ErrorCode::$paramError);
-            }
-        }else{
-            self::sendOutput('请配置钉钉apikey', ErrorCode::$paramError);
-        }
-
-        $res = $this->curl_get('https://oapi.dingtalk.com/gettoken?appkey='.$data['basicData']['appKey'].'&appsecret='.$data['basicData']['appSecret']);
-        $res = json_decode($res);
-        return $res->access_token;
-    }
-
-    /**
-     * group_key
-     * @return mixed
-     */
-    public function group_key($id)
-    {
-        $group_key = $this->post_json('https://oapi.dingtalk.com/topapi/attendance/groups/idtokey?access_token='.$this->voucher(),json_encode(['group_id' => $id]));
-        $group_key = json_decode($group_key);
-        if ($group_key->errcode > 0){
-            parent::sendOutput($group_key->errmsg, 1);
-        }
-        return $group_key->result;
-    }
-
-
-
-    public function curl_get($url, &$httpCode = 0)
-    {
-        $ch = curl_init();
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
-        //不做证书校验,部署在linux环境下请改为true
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
-        $file_contents = curl_exec($ch);
-        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-        curl_close($ch);
-        return $file_contents;
-    }
-
-    public function post_json($url , $params = array()){
-        //$data_string = json_encode($params,JSON_UNESCAPED_UNICODE);
-        $ch = curl_init();
-        curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_HEADER, 0);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
-        curl_setopt($ch, CURLOPT_POST, 1);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
-        curl_setopt(
-            $ch, CURLOPT_HTTPHEADER,
-            array(
-                'Content-Type: application/json'
-            )
-        );
-
-        $data = curl_exec($ch);
-        curl_close($ch);
-        return ($data);
-    }
-
-    public function getRandPass($length = 8)
-    {
-        $password = '';
-        $chars = "0123456789";
-
-        $char_len = strlen($chars);
-
-        for ($i = 0; $i <= $length; $i++) {
-            $loop = mt_rand(0, ($char_len - 1));
-            $password .= $chars[$loop];
-        }
-        return $password;
-
-    }
-}

+ 0 - 167
Controller/BlockManage/Element.Class.php

@@ -1,167 +0,0 @@
-<?php
-/**
- * 元素管理
- * Created by PhpStorm.
- * User: QianNiao-C
- * Date: 2019/10/25
- * Time: 14:56
- */
-
-namespace JinDouYun\Controller\BlockManage;
-
-use JinDouYun\Controller\BaseController;
-use Mall\Framework\Core\ErrorCode;
-
-use JinDouYun\Model\BlockManage\MElement;
-
-class Element extends BaseController
-{
-    public $objMElement;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMElement = new MElement();
-    }
-
-    /**
-     * 添加,编辑元素接收公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $elementFieldData = [
-            'elementData' => isset($params['data']) ? $params['data'] : '',//字段数据
-        ];
-        foreach ($elementFieldData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $elementFieldData['startTime'] = isset($params['startTime']) ? $params['startTime'] : 0;
-        $elementFieldData['endTime'] = isset($params['endTime']) ? $params['endTime'] : 0;
-        $elementFieldData['sort'] = isset($params['sort']) ? $params['sort'] : 0;
-        $elementFieldData['elementData'] = json_encode($elementFieldData['elementData']);
-        return $elementFieldData;
-    }
-
-    /**
-     * 添加区块下元素
-     */
-    public function addElement()
-    {
-        $zoneId = $this->request->param('zoneId');
-        if (empty($zoneId)) {
-            $this->sendOutput('请指定zoneId', ErrorCode::$paramError);
-        }
-
-        $elementFieldData = $this->commonFieldFilter();
-        $elementFieldData['zoneId'] = $zoneId;
-        $result = $this->objMElement->addElement($elementFieldData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取指定元素信息
-     */
-    public function getElementInfoById()
-    {
-        $id = $this->request->param('request_id');
-
-        if (!$id) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMElement->getElementInfoById($id);
-
-        if ($result->isSuccess()) {
-            $resultData = $result->getData();
-            $resultData['elementData'] = json_decode($resultData['elementData'], true);
-            $this->sendOutput($resultData);
-        }
-        $this->sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 编辑指定元素信息
-     */
-    public function editElement()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $elementData = $this->commonFieldFilter();
-        $elementData['id'] = $id;
-        unset($elementData['createTime']);
-        $result = $this->objMElement->editElement($elementData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 删除指定元素
-     */
-    public function delElement()
-    {
-        $id = $this->request->param('request_id');
-        if (!$id) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-
-        if (!is_array($id)) {
-            $id = [$id];
-        }
-
-        $result = $this->objMElement->delElement($id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取指定区块下的所有元素
-     */
-    public function getElementByZoneId()
-    {
-        $zoneId = $this->request->param('request_id');
-        if (empty($zoneId)) {
-            $this->sendOutput('请指定zoneId', ErrorCode::$paramError);
-        }
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-
-        $selectParams = [
-            'limit'  => $pageSize,
-            'offset' => $offset,
-            'zoneId' => $zoneId,
-            'type'   => 'all',//后台用获取所有数据
-        ];
-
-        $result = $this->objMElement->getElementByZoneId($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-}

+ 0 - 152
Controller/BlockManage/Zone.Class.php

@@ -1,152 +0,0 @@
-<?php
-/**
- * 区块管理后台
- * Created by PhpStorm.
- * User: QianNiao-C
- * Date: 2019/10/25
- * Time: 11:32
- */
-
-namespace JinDouYun\Controller\BlockManage;
-
-use Mall\Framework\Core\ErrorCode;
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\BlockManage\MZone;
-
-class Zone extends BaseController
-{
-    public $objMZone;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMZone = new MZone();
-    }
-
-    /**
-     * 添加,编辑区块接收公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $zoneFieldData = [
-            'title'    => isset($params['title']) ? $params['title'] : '',
-            'zoneData' => isset($params['data']) ? $params['data'] : '',
-        ];
-        foreach ($zoneFieldData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $zoneFieldData['zoneData'] = json_encode($zoneFieldData['zoneData']);
-        return $zoneFieldData;
-    }
-
-    /**
-     * 添加区块
-     */
-    public function addZone()
-    {
-        $zoneData = $this->commonFieldFilter();
-        $result = $this->objMZone->addZone($zoneData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 区块启用和禁用
-     */
-    public function updateEnableStatus()
-    {
-        $params['id'] = $this->request->param('request_id');
-        $params['enableStatus'] = $this->request->param('enableStatus');//5启用 4停用
-
-        foreach ($params as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $result = $this->objMZone->updateEnableStatus($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取指定区块信息
-     */
-    public function getZoneInfoById()
-    {
-        $id = $this->request->param('request_id');
-
-        if (!$id) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMZone->getZoneInfoById($id);
-        if ($result->isSuccess()) {
-            $resultData = $result->getData();
-            $resultData['zoneData'] = json_decode($resultData['zoneData'], true);
-            parent::sendOutput($resultData);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 编辑区块信息
-     */
-    public function editZone()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $zoneData = $this->commonFieldFilter();
-        $zoneData['id'] = $id;
-        unset($zoneData['createTime']);
-        $result = $this->objMZone->editZone($zoneData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取所有区块
-     */
-    public function getAllZone()
-    {
-        $page = $this->request->param('page') ?: 1;
-        $pageSize = $this->request->param('pageSize') ?: 10;
-
-        $offset = ($page - 1) * $pageSize;
-        $selectParams = [
-            'limit'  => $pageSize,
-            'offset' => $offset,
-        ];
-
-        $result = $this->objMZone->getAllZone($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-}

+ 0 - 305
Controller/Cart/ApiCart.Class.php

@@ -1,305 +0,0 @@
-<?php
-/**
- * 购物车
- * Created by PhpStorm.
- */
-namespace JinDouYun\Controller\Cart;
-
-use Mall\Framework\Core\ErrorCode;
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Cart\MCart;
-use Mall\Framework\Core\StatusCode;
-
-class ApiCart extends BaseController
-{
-    private $objMCart;
-
-    /**
-     * ApiCart constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true ,$checkToken=true,$getAreaCode=true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken = true, $getAreaCode = true);
-        $this->objMCart = new MCart($this->onlineUserId, $this->onlineEnterpriseId,true,$this->areaCode);
-    }
-
-    /**
-     * 添加购物车,公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $cartData = [
-            'goodsData' => isset($params['goodsData']) ? $params['goodsData'] : [], //商品数据
-        ];
-
-        foreach ($cartData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $goodsData = [];
-        foreach ($cartData['goodsData'] as $key => $val) {
-            $goodsData[$key] = [
-                'goodsBasicId' => isset($val['goodsBasicId']) ? $val['goodsBasicId'] : '',
-                'goodsId'      => isset($val['goodsId']) ? $val['goodsId'] : '',
-                'skuId'        => isset($val['skuId']) ? $val['skuId'] : '',
-                'buyNum'       => isset($val['buyNum']) ? $val['buyNum'] : '',
-                'shopId'       => isset($val['shopId']) ? $val['shopId'] : '',
-                'source'       => isset($val['source']) ? $val['source'] : '',
-            ];
-
-            foreach ($goodsData[$key] as $k => $v) {
-                if (empty($v)) {
-                    parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
-                }
-            }
-            $goodsData[$key]['goodsCode'] = createCode(StatusCode::$code['goodsBasic']['prefix'], $goodsData[$key]['goodsId'], StatusCode::$code['goodsBasic']['length']);
-        }
-        $cartData['goodsData'] = $goodsData;//过滤后数据
-        return $cartData;
-    }
-
-    /**
-     * 加入购物车
-     * @throws \Exception
-     */
-    public function addCart()
-    {
-        $cartData = $this->commonFieldFilter();
-        $result = $this->objMCart->addCartApi($cartData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 更新商品数量(购物车内操作)
-     * @throws \Exception
-     */
-    public function updateBuyNum()
-    {
-        $params['cartId'] = $this->request->param('request_id');
-        $params['buyNum'] = $this->request->param('buyNum');
-
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCart->updateBuyNumApi($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取用户购物车数据
-     * @throws \Exception
-     */
-    public function getCartByUserCenterId()
-    {
-        $result = $this->objMCart->getCartByUserCenterIdApi();
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => 0,
-                'pageSize'  => 0,
-                'pageTotal' => $returnData['total']
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * 更新选中状态
-     * @throws \Exception
-     */
-    public function updateSelection()
-    {
-        $paramsData = $this->request->getRawJson();
-        $params = [
-            'selection' => isset($paramsData['selection']) ? $paramsData['selection'] : '',//4=>未选中 5=>已选中
-            'type'      => isset($paramsData['type']) ? $paramsData['type'] : 0,//type 1单个 2店铺 3全选
-        ];
-
-        foreach ($params as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $params['id'] = isset($paramsData['cartId']) ? $paramsData['cartId'] : 0;//cartId
-        $params['shopId'] = isset($paramsData['shopId']) ? $paramsData['shopId'] : 0;//店铺id
-
-        $result = $this->objMCart->updateSelection($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 删除购物车中商品(可批量)
-     */
-    public function delCart()
-    {
-        $params = $this->request->getRawJson();
-        $paramsData = [
-            'id' => isset($params['cartId']) ? $params['cartId'] : 0,
-        ];
-
-        foreach ($paramsData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCart->delCart($paramsData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 确认订单接口
-     * @throws \Exception
-     */
-    public function confirmationOfOrder()
-    {
-        $vipCardId = $this->request->param('vipCardId');//会员卡id
-        $userCouponId=$this->request->param('userCouponId');//优惠券id
-        $addressId = $this->request->param('addressId');//收货地址id
-        $deliveryId = $this->request->param('deliveryId');//配送方式id
-        $proporties = $this->request->param('proporties');//店铺对应对应的收货地址以及配送方式
-        $result = $this->objMCart->confirmationOfOrder($userCouponId,$vipCardId,$addressId,$deliveryId);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 商品列表用
-     * @throws \Exception
-     */
-    public function updateCartNum()
-    {
-        $paramsData = $this->request->getRawJson();
-        if (empty($paramsData)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $params = [
-            'goodsId' => $this->request->param('request_id'),
-            'buyNum'  => isset($paramsData['buyNum']) ? $paramsData['buyNum'] : '',
-            'skuId'   => isset($paramsData['skuId']) ? $paramsData['skuId'] : '',
-        ];
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCart->updateCartNum($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取当前用户会员卡
-     */
-    public function getVipCard()
-    {
-        $result = $this->objMCart->getVipCard([]);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="立即购买")
-     * User: XMing
-     * Date: 2021/1/22
-     * Time: 4:01 下午
-     * @throws \Exception
-     */
-    public function buyNow()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['lists']) || empty($params['lists'])){
-            parent::sendOutput('请选择商品',ErrorCode::$paramError);
-        }
-        $lists = getArrayItem($params,'lists',[]);
-
-
-        $data = [
-            'sourceType' => getArrayItem($params,'sourceType',0),
-            'comBinId'   => getArrayItem($params,'couponId',0),
-            'couponId'   => getArrayItem($params,'couponId',0),
-            'addressId'  => getArrayItem($params,'addressId',0),
-            'deliveryId' => getArrayItem($params,'deliveryId',0),
-        ];
-        $result = $this->objMCart->buyNow($lists,$data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 普通商品立即购买
-     */
-    public function goodsBuyNow()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $goods = [
-            'goodsId' => isset($params['goodsId']) ? $params['goodsId'] : '',
-            'goodsBasicId' => getArrayItem($params, 'goodsBasicId', 0),
-            'skuId'   => isset($params['skuId']) ? $params['skuId'] : '',
-            'buyNum'  => isset($params['buyNum']) ? $params['buyNum'] : '',
-            'shopId'  => getArrayItem($params, 'shopId', 0),
-            'selection' => StatusCode::$standard,
-        ];
-        foreach ($goods as $key => $val) {
-            if (empty($val)) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $goods['activityId'] = getArrayItem($params, 'activityId', 0);
-
-        $data['vipCardId'] = getArrayItem($params, 'vipCardId', 0);
-        $data['couponId'] = isset($params['couponId']) ? $params['couponId'] : 0;
-        $data['addressId'] = isset($params['addressId']) ? $params['addressId'] : 0;
-        $data['deliveryId'] = isset($params['deliveryId']) ? $params['deliveryId'] : 0;
-
-        $result = $this->objMCart->goodsBuyNow($goods,$data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-}

+ 0 - 224
Controller/Cart/Cart.Class.php

@@ -1,224 +0,0 @@
-<?php
-/**
- * 购物车
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/6
- * Time: 16:10
- */
-
-namespace JinDouYun\Controller\Cart;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Cart\MCart;
-
-class Cart extends BaseController
-{
-    private $objMCart;
-
-    /**
-     * ApiCart constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $userCenterId = $this->request->param('request_id');
-        $this->onlineUserId = $userCenterId;
-        $this->objMCart = new MCart($this->onlineUserId, $this->onlineEnterpriseId);
-    }
-
-    /**
-     * 添加购物车,公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $cartData = [
-            'goodsData' => isset($params['goodsData']) ? $params['goodsData'] : [],//商品数据
-        ];
-
-        foreach ($cartData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $goodsData = [];
-        foreach ($cartData['goodsData'] as $key => $val) {
-            $goodsData[$key] = [
-                'goodsBasicId' => isset($val['goodsBasicId']) ? $val['goodsBasicId'] : '',
-                'goodsId'      => isset($val['goodsId']) ? $val['goodsId'] : '',
-                'skuId'        => isset($val['skuId']) ? $val['skuId'] : '',
-                'buyNum'       => isset($val['buyNum']) ? $val['buyNum'] : '',
-                'shopId'       => isset($val['shopId']) ? $val['shopId'] : '',
-                'source'       => isset($val['source']) ? $val['source'] : '',
-            ];
-
-            foreach ($goodsData[$key] as $k => $v) {
-                if (empty($v)) {
-                    parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
-                }
-            }
-            $goodsData[$key]['goodsCode'] = createCode(StatusCode::$code['goodsBasic']['prefix'], $goodsData[$key]['goodsId'], StatusCode::$code['goodsBasic']['length']);
-        }
-        $cartData['goodsData'] = $goodsData;//过滤后数据
-        return $cartData;
-    }
-
-    /**
-     * 加入购物车
-     * @throws \Exception
-     */
-    public function addCart()
-    {
-        $cartData = $this->commonFieldFilter();
-        $result = $this->objMCart->manageAddCart($cartData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 更新商品数量
-     * @throws \Exception
-     */
-    public function updateBuyNum()
-    {
-        $paramsData = $this->request->getRawJson();
-        $params = [
-            'cartId' => isset($paramsData['cartId']) ? $paramsData['cartId'] : '',
-            'buyNum' => isset($paramsData['buyNum']) ? $paramsData['buyNum'] : '',
-        ];
-
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $result = $this->objMCart->updateBuyNum($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * inventory字段废弃 inventoryNum库存数量
-     * 获取用户购物车数据
-     * @throws \Exception
-     */
-    public function getCartByUserCenterId()
-    {
-        $result = $this->objMCart->getManageCartByUserCenterId();
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => 0,
-                'pageSize'  => 0,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * 更新选中状态
-     * @throws \Exception
-     */
-    public function updateSelection()
-    {
-        $paramsData = $this->request->getRawJson();
-
-        $params = [
-            'selection' => isset($paramsData['selection']) ? $paramsData['selection'] : '',//4=>未选中 5=>已选中
-            'id'        => isset($paramsData['cartId']) ? $paramsData['cartId'] : 0,
-        ];
-
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $result = $this->objMCart->updateSelection($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 删除购物车中商品(可批量)
-     */
-    public function delCart()
-    {
-        $params = $this->request->getRawJson();
-        $paramsData = [
-            'id' => isset($params['cartId']) ? $params['cartId'] : 0,
-        ];
-
-        foreach ($paramsData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCart->delCart($paramsData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 清空指定用户下购物车数据
-     */
-    public function clearCart()
-    {
-        $result = $this->objMCart->clearCart();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 批量删除购物车商品
-     */
-    public function clearCartByGoodsId()
-    {
-        $params = $this->request->getRawJson();
-        $paramsData = [
-            'goodsId' => isset($params['goodsId']) ? $params['goodsId'] : '',
-        ];
-        foreach ($paramsData as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCart->clearCartByGoodsId($paramsData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 74
Controller/Cart/TestCart.Class.php

@@ -1,74 +0,0 @@
-<?php
-namespace JinDouYun\Controller\Cart;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Cart\MTestCart;
-use JinDouYun\Model\System\MEnterpriseBindPayment;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-class TestCart extends BaseController
-{
-    private $objMTestCart;
-
-    /**
-     * TestCart constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $thisChoiceCustomerId = $this->request->param('request_id');//当前选择的客户id
-        $this->objMTestCart = new MTestCart($this->onlineUserId, $this->onlineEnterpriseId, false, $thisChoiceCustomerId);
-    }
-
-    /**
-     * 添加购物车,公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (!isset($params['goodsData'])) {
-            parent::sendOutput('goodsData参数错误', ErrorCode::$paramError);
-        }
-        $goodsData = [];
-        foreach ($params['goodsData'] as $key => $val) {
-            $goodsData[$key] = [
-                'goodsBasicId' => isset($val['goodsBasicId']) ? $val['goodsBasicId'] : '',
-                'goodsId'      => isset($val['goodsId']) ? $val['goodsId'] : '',
-                'skuId'        => isset($val['skuId']) ? $val['skuId'] : '',
-                'buyNum'       => isset($val['buyNum']) ? $val['buyNum'] : '',
-                'shopId'       => isset($val['shopId']) ? $val['shopId'] : '',
-                'source'       => isset($val['source']) ? $val['source'] : '',
-            ];
-
-            foreach ($goodsData[$key] as $k => $v) {
-                if (empty($v)) {
-                    parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
-                }
-            }
-            $goodsData[$key]['goodsCode'] = createCode(StatusCode::$code['goodsBasic']['prefix'], $goodsData[$key]['goodsId'], StatusCode::$code['goodsBasic']['length']);
-        }
-        $cartData['goodsData'] = $goodsData;//过滤后数据
-        return $cartData;
-    }
-
-
-    /**
-     * 加入购物车
-     * @throws \Exception
-     */
-    public function addCart()
-    {
-        $cartData = $this->commonFieldFilter();
-        $result = $this->objMTestCart->addCart($cartData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-}

+ 0 - 478
Controller/Cashier/Cashier.Class.php

@@ -1,478 +0,0 @@
-<?php
-
-namespace JInDouYun\Controller\Cashier;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Cashier\MCashier;
-use JinDouYun\Model\Cashier\MCashierCart;
-use JinDouYun\Model\Market\MCoupon;
-use JinDouYun\Model\Enterprise\MEnterprise;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-
-/**
- * Description: 收银台,订单计算提成
- * Class Cashier
- * @package JInDouYun\Controller\Cashier
- */
-class Cashier extends BaseController
-{
-    /**
-     * @var MCashier
-     */
-    private $objMCashier;
-    private $objMEnterprise;
-    
-
-    /**
-     * Cashier constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCashier = new MCashier($this->onlineUserId, $this->onlineEnterpriseId);
-        $this->objMEnterprise = new MEnterprise();
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/2
-     * Time: 12:13 下午
-     * @throws \Exception
-     */
-    public function calculatePushMoney()
-    {
-        $params = $this->request->getRawJson();
-        if (!isset($params['orderId'])) {
-            parent::sendOutput('orderId参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMCashier->calculatePushMoney($params['orderId']);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="收银台统计")
-     * User: XMing
-     * Date: 2020/9/3
-     * Time: 3:01 下午
-     */
-    public function overView()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$dberror);
-        }
-        $pageParams = pageToOffset(isset($params['page']) ? $params['page'] : 1, isset($params['pageSize']) ? $params['pageSize'] : 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCashier->overView($params);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => isset($params['page']) ? $params['page'] : 1,
-            'pageSize'  => isset($params['pageSize']) ? $params['pageSize'] : 10,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="根据手机号检索会员信息")
-     * User: XMing
-     * Date: 2020/9/11
-     * Time: 2:23 下午
-     * @throws \Exception
-     */
-    public function searchCustomerDetails()
-    {
-        $mobile = $this->request->param('mobile');
-        if (empty($mobile)) {
-            parent::sendOutput('mobile参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMCashier->searchCustomerDetails($mobile);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-    
-    /**
-     * Doc: (des="获取通用收银客户信息")
-     * User: XMing
-     * Date: 2020/9/11
-     * Time: 2:23 下午
-     * @throws \Exception
-     */
-    public function getCommonCustomerInfo()
-    {
-        if(empty($this->onlineEnterpriseId)){
-            parent::sendOutput('企业信息不存在', ErrorCode::$paramError);
-        }
-        $params['enterpriseId'] = $this->onlineEnterpriseId;
-        
-        $result = $this->objMEnterprise->getEnterpriseInfo($params);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $data = $result->getData();
-        if(empty($data )){
-            parent::sendOutput('企业信息不存在', ErrorCode::$paramError);
-        }
-//        $mobile = $data["commonCashierCustomerMobile"];
-        $mobile = "13600000001";
-        $result = $this->objMCashier->searchCustomerDetails($mobile);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 添加购物车,公共字段
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $cartData = [
-            'goodsData' => isset($params['goodsData']) ? $params['goodsData'] : [],//商品数据
-        ];
-
-        foreach ($cartData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $goodsData = [];
-        foreach ($cartData['goodsData'] as $key => $val) {
-            $goodsData[$key] = [
-                'goodsBasicId' => isset($val['goodsBasicId']) ? $val['goodsBasicId'] : '',
-                'goodsId'      => isset($val['goodsId']) ? $val['goodsId'] : '',
-                'skuId'        => isset($val['skuId']) ? $val['skuId'] : '',
-                'buyNum'       => isset($val['buyNum']) ? $val['buyNum'] : '',
-                'shopId'       => isset($val['shopId']) ? $val['shopId'] : '',
-                'source'       => isset($val['source']) ? $val['source'] : '',
-                'warehouseId'       => isset($val['warehouseId']) ? $val['warehouseId'] : '',
-            ];
-
-            foreach ($goodsData[$key] as $k => $v) {
-                if (empty($v)) {
-                    parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
-                }
-            }
-            $goodsData[$key]['goodsCode'] = createCode(StatusCode::$code['goodsBasic']['prefix'], $goodsData[$key]['goodsId'], StatusCode::$code['goodsBasic']['length']);
-        }
-        $cartData['goodsData'] = $goodsData;//过滤后数据
-        return $cartData;
-    }
-
-    /**
-     * Doc: (des="加入购物车")
-     * User: XMing
-     * Date: 2020/9/12
-     * Time: 9:58 上午
-     * @throws \Exception
-     */
-    public function addCart()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        $warehouseId = $this->request->param('warehouseId');
-        $cartData = $this->commonFieldFilter();
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//
-        }
-        $result = false;
-        $objMCashierCart = new MCashierCart($userCenterId,$this->onlineEnterpriseId,$this->onlineUserId);
-        foreach ($cartData['goodsData'] as $val){
-            $result = $objMCashierCart->addCartApi(['goodsData' => [$val]]);
-        }
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 更新商品数量(购物车内操作)
-     * @throws \Exception
-     */
-    public function updateBuyNum()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        $cartId = $this->request->param('request_id');
-        if (empty($cartId)) {
-            parent::sendOutput('id参数错误', ErrorCode::$paramError);
-        }
-        $params = $this->request->getRawJson();
-        $params['cartId'] = $cartId;
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $objMCashierCart = new MCashierCart($userCenterId, $this->onlineEnterpriseId,$this->onlineUserId);
-        $result = $objMCashierCart->updateBuyNumApi($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 删除购物车中商品(可批量)
-     * @throws \Exception
-     */
-    public function delCart()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        $params = $this->request->getRawJson();
-        $paramsData = [
-            'id' => isset($params['cartId']) ? $params['cartId'] : 0,
-        ];
-        foreach ($paramsData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $objMCashierCart = new MCashierCart($userCenterId, $this->onlineEnterpriseId,$this->onlineUserId);
-        $result = $objMCashierCart->delCart($paramsData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 获取用户购物车数据
-     * @throws \Exception
-     */
-    public function getCartByUserCenterId()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        $userCouponId = $this->request->param('userCouponId');//优惠券id
-        $params = $this->request->getRawJson();
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $objMCashierCart = new MCashierCart($userCenterId, $this->onlineEnterpriseId, $this->onlineUserId);
-        $isZero = isset($params['isZero']) && !empty($params['isZero']) ? $params['isZero'] : StatusCode::$delete;
-        $result = $objMCashierCart->getCashierCartByUserCenterIdApi($isZero,$userCouponId);
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => 0,
-                'pageSize'  => 0,
-                'pageTotal' => $returnData['total']
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/12
-     * Time: 10:57 上午
-     * @throws \Exception
-     */
-    public function clearCart()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $objMCashierCart = new MCashierCart($userCenterId, $this->onlineEnterpriseId,$this->onlineUserId);
-        $result = $objMCashierCart->clearCart();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/11
-     * Time: 6:09 下午
-     */
-    public function saveEntryData()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'shopId' => isset($params['shopId']) ? $params['shopId'] : null,
-            'entryData' => isset($params['entryData']) ? json_encode($params['entryData']) : null,
-        ];
-        foreach ($data as $key => $val){
-            if (empty($val)){
-                parent::sendOutput($key.'参数错误',ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCashier->saveEntryData($data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="获取挂单记录")
-     * User: XMing
-     * Date: 2020/9/12
-     * Time: 6:20 下午
-     */
-    public function getAllEntryData()
-    {
-        $paramsData = $this->request->getRawJson();
-        $params = [
-            'pageSize' => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
-            'page'     => isset($paramsData['page']) ? $paramsData['page'] : 1,
-            'shopId'   => isset($paramsData['shopId']) ? $paramsData['shopId'] : null,
-        ];
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $offset = ($params['page'] - 1) * $params['pageSize'];
-        $selectParams = [
-            'limit'  => $params['pageSize'],
-            'offset' => $offset,
-            'shopId' => $params['shopId']
-        ];
-        $dbResult = $this->objMCashier->getAllEntryData($selectParams);
-        if ($dbResult->isSuccess()) {
-            $returnData = $dbResult->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * Doc: (des="取单")
-     * User: XMing
-     * Date: 2020/9/12
-     * Time: 6:27 下午
-     */
-    public function getEntryData()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)){
-            parent::sendOutput('id参数错误',ErrorCode::$paramError);
-        }
-        $dbResult = $this->objMCashier->getEntryData($id);
-        if ($dbResult->isSuccess()) {
-            parent::sendOutput($dbResult->getData());
-        }
-        parent::sendOutput($dbResult->getData(), $dbResult->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="删除挂单")
-     * User: XMing
-     * Date: 2020/9/12
-     * Time: 6:38 下午
-     */
-    public function delEntryData()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)){
-            parent::sendOutput('id参数错误',ErrorCode::$paramError);
-        }
-        $dbResult = $this->objMCashier->delEntryData($id);
-        if ($dbResult->isSuccess()) {
-            parent::sendOutput($dbResult->getData());
-        }
-        parent::sendOutput($dbResult->getData(), $dbResult->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="收银台修改商品价格")
-     * User: XMing
-     * Date: 2020/9/14
-     * Time: 9:24 上午
-     */
-    public function changePrice()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $params = $this->request->getRawJson();
-        $data = [
-            'goodsId'=>isset($params['goodsId']) ? $params['goodsId'] : null,
-            'skuId'  => isset($params['skuId']) ? $params['skuId'] : null,
-            'changePrice' => isset($params['changePrice']) ? $params['changePrice'] : null,
-            'customerUid' => $userCenterId,
-        ];
-        foreach ($data as $key => $val){
-            if (empty($val)){
-                parent::sendOutput($key.'参数错误',ErrorCode::$paramError);
-            }
-        }
-        $dbResult = $this->objMCashier->changePrice($data);
-        if ($dbResult->isSuccess()) {
-            parent::sendOutput($dbResult->getData());
-        }
-        parent::sendOutput($dbResult->getData(), $dbResult->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="收银台营销活动")
-     * User: XMing
-     * Date: 2020/9/14
-     * Time: 2:26 下午
-     * @throws \Exception
-     */
-    public function activityAll()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        if (empty($userCenterId)) {
-            $userCenterId = StatusCode::$noneUserCenter;//TODO(匿名用户,客户表中存一个匿名客户)
-        }
-        $paramsData = $this->request->getRawJson();
-        $pageParams = pageToOffset(isset($paramsData['page']) ? $paramsData['page'] : 1, isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['type'] = StatusCode::$standard;
-        $objMCoupon = new MCoupon($userCenterId,$this->onlineEnterpriseId);
-        $result = $objMCoupon->selectAll($params);
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => isset($paramsData['page']) ? $paramsData['page'] : 1,
-                'pageSize'  => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-
-}

+ 0 - 3
Controller/Cashier/Cashier.md

@@ -1,3 +0,0 @@
-### 收银员登陆流程
-1. 用户登陆后台点击收银台地址,直接跳转至收银台首页,
-2. 收银员直接在收银地址登陆

+ 0 - 118
Controller/Cashier/CashierGoods.Class.php

@@ -1,118 +0,0 @@
-<?php
-namespace JInDouYun\Controller\Cashier;
-
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Goods\MGoods;
-use Mall\Framework\Core\ErrorCode;
-
-/**
- * Description:
- * Class CashierGoods
- * @package JInDouYun\Controller\Cashier
- */
-class CashierGoods extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/7
-     * Time: 9:27 上午
-     * @throws \Exception
-     */
-    public function getGoodsByCategory()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-        $selectParams = [
-            'categoryId' => isset($params['categoryId']) ? $params['categoryId'] : '',
-            'keyword' => isset($params['keyword']) ? $params['keyword'] : '',
-            'areaCode'=> '',
-            'shopId'  => isset($params['shopId']) ? $params['shopId'] : '',
-        ];
-        if(empty($selectParams["shopId"])){
-            $this->sendOutput('请先选择门店', ErrorCode::$paramError );
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        if (isset($params['userCenterId']) && !empty($params['userCenterId'])){
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$params['userCenterId']);
-        }else{
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$this->onlineUserId);
-        }
-        $selectParams['userCenterId'] = isset($params['userCenterId']) ? $params['userCenterId'] : $this->onlineUserId;
-        $result = $objMGoods->search($selectParams);
-        if($result->isSuccess()){
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/30
-     * Time: 3:08 下午
-     * @throws \Exception
-     */
-    public function getGoodsByBarCode()
-    {
-        $userCenterId = $this->request->param('userCenterId');
-        if (!empty($userCenterId)){
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$userCenterId);
-        }else{
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$this->onlineUserId);
-        }
-        $params = $this->request->getRawJson();
-        if (empty($params['barCode'])) {
-            $this->sendOutput('barCode参数为空', ErrorCode::$paramError);
-        }
-        $result = $objMGoods->getGoodsByBarCode($params['barCode']);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/7
-     * Time: 9:44 上午
-     * @throws \Exception
-     */
-    public function getGoodsDetail()
-    {
-        $goodsId  = $this->request->param('request_id');
-        $userCenterId = $this->request->param('userCenterId');
-        if ( !$goodsId ) {
-            self::sendOutput('参数错误', ErrorCode::$paramError );
-        }
-        if (!empty($userCenterId)){
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$userCenterId);
-        }else{
-            $objMGoods = new MGoods($this->onlineEnterpriseId,true,$this->onlineUserId);
-        }
-        $result = $objMGoods->getApiGoodsInfo($goodsId, '');
-        if($result->isSuccess()){
-            $resultData = $result->getData();
-            self::sendOutput($resultData);
-        }
-        self::sendOutput($result->getData(), $result->getErrorCode());
-    }
-}

+ 0 - 117
Controller/Cashier/Guide.Class.php

@@ -1,117 +0,0 @@
-<?php
-namespace JInDouYun\Controller\Cashier;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Cashier\MCashierGuide;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-/**
- * Description: 导购员 废弃
- * Class Guide
- * @package JInDouYun\Controller\Cashier
- */
-class Guide extends BaseController
-{
-    /**
-     * @var MCashierGuide
-     */
-    private $objMCashierGuide;
-
-    /**
-     * Guide constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCashierGuide = new MCashierGuide($this->onlineUserId, $this->onlineEnterpriseId);
-    }
-
-    /**
-     * Doc: (des="导购员列表")
-     * User: XMing
-     * Date: 2020/8/31
-     * Time: 3:46 下午
-     */
-    public function getAll()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCashierGuide->getAll($params);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize'  => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="导购员添加")
-     * User: XMing
-     * Date: 2020/8/31
-     * Time: 4:23 下午
-     */
-    public function add()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput('参数为空',ErrorCode::$paramError);
-        }
-        $data = [
-            'name' => isset($params['name']) ? $params['name'] : null,
-            'mobile' => isset($params['mobile']) ? $params['mobile'] : null,
-            'isSetRule' => isset($params['isSetRule']) ? $params['isSetRule'] : null,
-            'enableStatus' => isset($params['enableStatus']) ? $params['enableStatus'] : null,
-        ];
-        foreach ($data as $key => $value){
-            if(empty($value)){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        if($data['isSetRule'] == StatusCode::$standard){
-            if (!isset($params['rule']) || empty($params['rule'])){
-                parent::sendOutput('rule参数错误',ErrorCode::$paramError);
-            }
-            $data['rule'] = json_encode($params['rule']);
-        }
-        $result = $this->objMCashierGuide->add($data);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 9:30 上午
-     */
-    public function getInfo()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)){
-            parent::sendOutput('id参数错误',ErrorCode::$paramError);
-        }
-        $result = $this->objMCashierGuide->getInfo($id);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-}

+ 0 - 179
Controller/Cashier/PushMoney.Class.php

@@ -1,179 +0,0 @@
-<?php
-
-namespace JInDouYun\Controller\Cashier;
-
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Cashier\MCashierPushMoneyDetail;
-use Mall\Framework\Core\ErrorCode;
-
-/**
- * Description:
- * Class PushMoney
- * @package JInDouYun\Controller\Cashier
- */
-class PushMoney extends BaseController
-{
-    /**
-     * @var MCashierPushMoneyDetail
-     */
-    private $objMCashierPushMoneyDetail;
-
-    /**
-     * PushMoney constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCashierPushMoneyDetail = new MCashierPushMoneyDetail($this->onlineUserId,$this->onlineEnterpriseId);
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/8/31
-     * Time: 5:41 下午
-     */
-    public function getAll()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['pushType']) || empty($params['pushType'])){
-            parent::sendOutput('pushType参数错误',ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCashierPushMoneyDetail->getAll($params);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize'  => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="获取交班记录")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 11:12 上午
-     */
-    public function getRecordList()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCashierPushMoneyDetail->getRecordList($params);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize'  => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="收款记录详情")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 11:35 上午
-     */
-    public function getRecordInfo()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)){
-            parent::sendOutput('id参数错误',ErrorCode::$paramError);
-        }
-        $result = $this->objMCashierPushMoneyDetail->getRecordInfo($id);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="1.获取交接详情")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 12:01 下午
-     */
-    public function connectDetails()
-    {
-        $shopId  = $this->request->param('shopId');
-        if (empty($shopId)){
-            parent::sendOutput('shopId参数错误',ErrorCode::$paramError);
-        }
-        $result = $this->objMCashierPushMoneyDetail->connectDetails($shopId);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="2.确定交接")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 12:18 下午
-     */
-    public function confirmConnect()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)){
-            parent::sendOutput('缺少id参数',ErrorCode::$paramError);
-        }
-        $offDutyTime = $this->request->param('offDutyTime');
-        if (empty($offDutyTime) || !is_numeric($offDutyTime)){
-            parent::sendOutput('offDutyTime参数错误',ErrorCode::$paramError);
-        }
-        $remark = $this->request->param('remark');
-        $result = $this->objMCashierPushMoneyDetail->confirmConnect($id,$offDutyTime,$remark);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="3.收银登陆")
-     * User: XMing
-     * Date: 2020/9/1
-     * Time: 2:35 下午
-     */
-    public function loggerConnect()
-    {
-        $params = $this->request->getRawJson();
-        /*if (!isset($params['mobile']) || empty($params['mobile'])){
-            parent::sendOutput('mobile参数错误',ErrorCode::$paramError);
-        }*/
-        if (!isset($params['shopId']) || empty($params['shopId'])){
-            parent::sendOutput('shopId参数错误',ErrorCode::$paramError);
-        }
-        $result = $this->objMCashierPushMoneyDetail->loggerConnect($params);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-}

+ 0 - 64
Controller/Cashier/Settings.Class.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace JInDouYun\Controller\Cashier;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Cashier\MCashierSettings;
-use Mall\Framework\Core\ErrorCode;
-
-/**
- * Description:
- * Class Settings
- * @package JInDouYun\Controller\Cashier
- */
-class Settings extends BaseController
-{
-    /**
-     * @var MCashierSettings
-     */
-    private $objMCashierSettings;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCashierSettings = new MCashierSettings($this->onlineUserId,$this->onlineEnterpriseId);
-    }
-
-    /**
-     * Doc: (des="配置")
-     * User: XMing
-     * Date: 2020/8/31
-     * Time: 2:00 下午
-     */
-    public function set()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput('参数为空',ErrorCode::$paramError);
-        }
-        $data = [
-            'content' => json_encode($params),
-            'enterpriseId' => $this->onlineEnterpriseId
-        ];
-        $result = $this->objMCashierSettings->set($data);
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="获取配置")
-     * User: XMing
-     * Date: 2020/8/31
-     * Time: 2:02 下午
-     */
-    public function get()
-    {
-        $result = $this->objMCashierSettings->get();
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-}

+ 0 - 198
Controller/Charts/Charts.Class.php

@@ -1,198 +0,0 @@
-<?php
-namespace JinDouYun\Controller\Charts;
-
-use App\Tools\ErrorCode;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Charts\MCharts;
-
-/**
- * @copyright   Copyright (c) https://www.qianniaovip.com All rights reserved
- * Description: 报表
- * Class Charts
- * @package JinDouYun\Controller\Charts
- */
-class Charts extends BaseController
-{
-
-    private $objMCharts;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false, $checkShopToken = true, $checkSupplierToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken, $checkSupplierToken);
-        $this->objMCharts = new MCharts($this->onlineUserId,$this->onlineEnterpriseId);
-    }
-
-    /**
-     * Doc: (des="商品销售报表")
-     * User: XMing
-     * Date: 2021/3/29
-     * Time: 10:49 上午
-     * @throws \Exception
-     */
-    public function goods()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->goods($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="客户商品报表")
-     * User: XMing
-     * Date: 2021/3/29
-     * Time: 2:22 下午
-     * @throws \Exception
-     */
-    public function customerGoods()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->customerGoods($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="订单数据表表")
-     * User: XMing
-     * Date: 2021/3/29
-     * Time: 3:11 下午
-     */
-    public function order()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->order($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="客户订单报表")
-     * User: XMing
-     * Date: 2021/3/29
-     * Time: 4:01 下午
-     * @throws \Exception
-     */
-    public function customerOrder()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->customerOrder($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="业务员订单报表")
-     * User: XMing
-     * Date: 2021/3/29
-     * Time: 4:01 下午
-     * @throws \Exception
-     */
-    public function salesManOrder()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->salesManOrder($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="地区订单报表")
-     * User: XMing
-     * Date: 2021/3/30
-     * Time: 10:08 上午
-     * @throws \Exception
-     */
-    public function areaOrder()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)){
-            parent::sendOutput("参数为空",ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $result = $this->objMCharts->areaOrder($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-}

+ 0 - 296
Controller/Commission/ApiCommissionBusinessman.Class.php

@@ -1,296 +0,0 @@
-<?php
-/**
- * api分销商Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Controller\Commission;
-
-use Exception;
-use JinDouYun\Model\Commission\MCommissionGrade;
-use JinDouYun\Model\Commission\MCommissionOrder;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionBusinessman;
-
-use Util\Common\PartnerTools;
-use JinDouYun\Model\Customer\MCustomer;
-
-class ApiCommissionBusinessman extends BaseController
-{
-    /**
-     * @var MCommissionBusinessman
-     */
-    private $objMCommissionBusinessman;
-
-    /**
-     * @var MCommissionOrder
-     */
-    private $objMCommissionOrder;
-    
-    
-    private $customerData;
-    private $partnerTool;
-
-    /**
-     * ApiCommissionBusinessman constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @throws Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken=true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMCommissionBusinessman = new MCommissionBusinessman($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMCommissionOrder = new MCommissionOrder($this->onlineEnterpriseId,$this->onlineUserId);
-        
-        $this->partnerTool = new PartnerTools($this->onlineEnterpriseId);
-        $this->customerData = $this->partnerTool->getCustomerDataByUserCenterId($this->onlineUserId);
-    }
-
-    /**
-     * 获取参数
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value) && $value !== 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        (isset($params['info']) && !empty($params['info'])) && $data['info'] = $params['info'];
-        (isset($params['gradeId']) && !empty($params['gradeId'])) && $data['gradeId'] = $params['gradeId'];
-        (isset($params['grade']) && !empty($params['grade'])) && $data['grade'] = $params['grade'];
-
-        return $data;
-    }
-
-    /**
-     * 申请分销商
-     * @throws Exception
-     */
-    public function applicationBusinessman()
-    {
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionBusinessman->addBusinessman($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 添加上下级关系
-     * @throws Exception
-     */
-    public function relationshipBusinessman()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $data = [
-            'businessmanId' => getArrayItem($params, 'businessmanId'),
-            'source' => getArrayItem($params, 'source'),
-        ];
-        //新分销合伙人添加下级
-        if(!empty($data['businessmanId']) && !empty($this->customerData["id"])){
-            $this->partnerTool->setPushCustomer($data['businessmanId'], $this->customerData["id"]);
-        }
-        
-        foreach($data as $key => $value){
-            if(empty($value) && $value !== 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $modelResult = $this->objMCommissionBusinessman->relationshipBusinessman($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-    
-    /**
-     * 修改分销商
-     * @throws Exception
-     */
-    public function updateBusinessman()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionBusinessman->updateBusinessman($data, ['id' => $id]);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 分销商详情
-     */
-    public function getInfoBusinessman()
-    {
-        $where['userCenterId'] = $this->onlineUserId;
-        $modelResult = $this->objMCommissionBusinessman->getInfoBusinessman($where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询分销商的所有下级
-     * @throws Exception
-     */
-    public function getAllSub()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'id' => isset($params['id']) ? $params['id'] : '',
-            'level' => isset($params['level']) ? $params['level'] : '',
-            'page' => isset($params['page']) ? $params['page'] : '',
-            'pageSize' => isset($params['pageSize']) ? $params['pageSize'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value) && $value !== 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        $pageParams = pageToOffset($params['page'],$params['pageSize']);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $modelResult = $this->objMCommissionBusinessman->getAllSub($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-            'subTotal' => $returnData['subTotal'],
-            'businessmanTotal' => $returnData['businessmanTotal'],
-            'subBusinessmanTotal' => $returnData['subBusinessmanTotal'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 排行榜
-     */
-    public function commissionTop()
-    {
-        $modelResult = $this->objMCommissionBusinessman->statisticsCommissionThree();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 等级说明
-     */
-    public function getAllGrade()
-    {
-        $modelResult = $this->objMCommissionBusinessman->getBusinessmanGradeInfo();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * Doc: (des="分销中心订单列表")
-     * User: XMing
-     * Date: 2020/7/30
-     * Time: 10:47 上午
-     * @throws Exception
-     */
-    public function getCommissionOrder()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $pageParams = pageToOffset($params['page'] ? $params['page'] : 1, $params['pageSize'] ? $params['pageSize'] : 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-
-        $modelResult = $this->objMCommissionOrder->getCommissionOrder($params);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="分销订单详情")
-     * User: XMing
-     * Date: 2020/7/30
-     * Time: 4:06 下午
-     * @throws Exception
-     */
-    public function getCommissionOrderInfo()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionOrder->getCommissionOrderInfo($id);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-
-    /**
-     * 修改直系上级关系
-     * @throws Exception
-     * 客户id,上级id
-     */
-    public function editRelationship()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params['id']) || empty($params['superiorId']) ){
-            parent::sendOutput('分销商参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMCommissionBusinessman->editRelationship($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-}

+ 0 - 69
Controller/Commission/ApiCommissionSetting.Class.php

@@ -1,69 +0,0 @@
-<?php
-/**
- * 前台分销商设置Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Controller\Commission;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionSetting;
-
-class ApiCommissionSetting extends BaseController
-{
-    private $objMCommissionSetting;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken=true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMCommissionSetting = new MCommissionSetting($this->onlineEnterpriseId, $this->onlineUserId);
-    }
-
-    /**
-     * 查询设置
-     * @throws Exception
-     */
-    public function getSetting()
-    {
-        $modelResult = $this->objMCommissionSetting->getSetting(true, true);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询商品
-     * @throws Exception
-     */
-    public function getBuyGoods()
-    {
-        $modelResult = $this->objMCommissionSetting->getBuyGoods();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询文字设置
-     */
-    public function getTxtSetting()
-    {
-        $modelResult = $this->objMCommissionSetting->getTxtSetting();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-
-}

+ 0 - 117
Controller/Commission/ApiCommissionWithdrawals.Class.php

@@ -1,117 +0,0 @@
-<?php
-/**
- * 分销体现记录Model
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2020/07/22
- * Time: 15:00
- */
-namespace JinDouYun\Controller\Commission;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionWithdrawals;
-
-class ApiCommissionWithdrawals extends BaseController
-{
-    private $objMCommissionWithdrawals;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMCommissionWithdrawals = new MCommissionWithdrawals($this->onlineUserId, $this->onlineEnterpriseId);
-    }
-
-    /**
-     * 添加提现记录
-     */
-    public function add()
-    {
-        $paramsData = $this->request->getRawJson();
-
-        $params = [
-            'userCenterId' => $this->onlineUserId,
-            'businessmanId' => isset($paramsData['businessmanId']) ? $paramsData['businessmanId'] : '',
-            'type'     => isset($paramsData['type']) ? $paramsData['type'] : '',
-            'accountContent' => isset($paramsData['accountContent']) ? $paramsData['accountContent'] : '',
-            'money' => isset($paramsData['money']) ? $paramsData['money'] : '',
-            'nowMoney' => isset($paramsData['nowMoney']) ? $paramsData['nowMoney'] : '',
-            'createTime' => time(),
-            'updateTime' => time(),
-        ];
-
-        foreach ($params as $k => $v) {
-            if (empty($v) && $v !== 0) {
-                $this->sendOutput($k . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-
-        $result = $this->objMCommissionWithdrawals->add($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 获取所有的体现记录
-     */
-    public function getAll()
-    {
-        $paramsData = $this->request->getRawJson();
-
-        $selectParams = [
-            'page'     => isset($paramsData['page']) ? $paramsData['page'] : 1,
-            'pageSize' => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
-            'auditStatus' => isset($paramsData['auditStatus']) ? $paramsData['auditStatus'] : '',
-        ];
-
-        foreach ($selectParams as $k => $v) {
-            if (empty($v) && $v !== 0) {
-                $this->sendOutput($k . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $pageParams = pageToOffset($selectParams['page'], $selectParams['pageSize']);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $result = $this->objMCommissionWithdrawals->getAll($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $paramsData['page'],
-                'pageSize'  => $paramsData['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 详情接口
-     */
-    public function detail()
-    {
-        $id = $this->request->param('request_id');
-        if (!$id) {
-            parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
-        }
-
-
-        $result = $this->objMCommissionWithdrawals->detail($id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 99
Controller/Commission/Commission.Class.php

@@ -1,99 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Commission;
-
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Commission\MCommissionCalculate;
-use Mall\Framework\Core\ErrorCode;
-
-class Commission extends BaseController
-{
-    private $objMCommissionCalculate;
-
-    /**
-     * CommissionCalculate constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCommissionCalculate = new MCommissionCalculate($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/7/28
-     * Time: 5:52 下午
-     * @throws \Exception
-     */
-    public function createCommission()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['orderId']) || empty($params['orderId'])){
-            parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['customerId']) || empty($params['customerId'])){
-            parent::sendOutput('customerId参数错误', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionCalculate->createCommission($params['customerId'],$params['orderId']);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * Doc: (des="订单完成将等待入账转移到余额")
-     * User: XMing
-     * Date: 2020/7/30
-     * Time: 6:27 下午
-     */
-    public function updateBalance()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['orderId']) || empty($params['orderId'])){
-            parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionCalculate->updateBalance($params['orderId']);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * Doc: (des="分销订单取消,扣除待入账")
-     * User: XMing
-     * Date: 2020/7/31
-     * Time: 6:04 下午
-     */
-    public function cancelSubCommission()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if (!isset($params['orderId']) || empty($params['orderId'])){
-            parent::sendOutput('orderId参数为空', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionCalculate->cancelSubCommission($params['orderId']);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-}

+ 0 - 302
Controller/Commission/CommissionBusinessman.Class.php

@@ -1,302 +0,0 @@
-<?php
-/**
- * 分销商Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Controller\Commission;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionBusinessman;
-
-class CommissionBusinessman extends BaseController
-{
-    private $objMCommissionBusinessman;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCommissionBusinessman = new MCommissionBusinessman($this->onlineEnterpriseId, $this->onlineUserId);
-    }
-
-    /**
-     * 获取参数
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value) && $value !== 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        (isset($params['info']) && !empty($params['info'])) && $data['info'] = $params['info'];
-        (isset($params['gradeId']) && !empty($params['gradeId'])) && $data['gradeId'] = $params['gradeId'];
-        (isset($params['grade']) && !empty($params['grade'])) && $data['grade'] = $params['grade'];
-
-        return $data;
-    }
-
-    /**
-     * 新增分销商
-     * @throws Exception
-     */
-    public function addBusinessman()
-    {
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionBusinessman->addBusinessman($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 删除分销商
-     * @throws Exception
-     */
-    public function delBusinessman()
-    {
-        $params = $this->request->getRawJson();
-        $where = [];
-        isset($params['userCenterId']) && $where['userCenterId'] = $params['userCenterId'];
-        if(!isset($where['userCenterId'])){
-            parent::sendOutput('userCenterId参数错误', ErrorCode::$paramError);
-        }
-
-        $update = [
-            'deleteStatus' => StatusCode::$delete
-        ];
-
-        $modelResult = $this->objMCommissionBusinessman->updateBusinessman($update, $where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 分销商审核
-     * @throws Exception
-     */
-    public function auditBusinessman()
-    {
-        $params = $this->request->getRawJson();
-        $where = [];
-        isset($params['userCenterId']) && $where['userCenterId'] = $params['userCenterId'];
-        $update = [
-            'auditStatus' => StatusCode::$auditStatus['auditPass']
-        ];
-        if(empty($where)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        if(!isset($where['userCenterId'])){
-            parent::sendOutput('userCenterId参数错误', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionBusinessman->updateBusinessman($update, $where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 修改分销商
-     * @throws Exception
-     */
-    public function updateBusinessman()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionBusinessman->updateBusinessman($data, ['userCenterId' => $id]);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 分销商列表
-     */
-    public function getAllBusinessman()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $selectParams = [];
-        $params['page'] = isset($params['page']) ? $params['page'] : 1;
-        $params['pageSize'] = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        if(isset($params['auditStatus']) && !empty($params['auditStatus'])){
-            $selectParams['auditStatus'] = $params['auditStatus'];
-        }
-
-        if(isset($params['search']) && !empty($params['search'])){
-            $selectParams['search'] = $params['search'];
-        }
-
-        if(isset($params['grade']) && !empty($params['grade'])){
-            $selectParams['grade'] = $params['grade'];
-        }
-
-        if(isset($params['createStar']) && !empty($params['createStar']) && isset($params['createEnd']) && !empty($params['createEnd'])){
-            $selectParams['createStar'] = $params['createStar'];
-            $selectParams['createEnd'] = $params['createEnd'];
-        }
-
-        if(isset($params['applicationStar']) && !empty($params['applicationStar']) && isset($params['applicationEnd']) && !empty($params['applicationEnd'])){
-            $selectParams['applicationStar'] = $params['applicationStar'];
-            $selectParams['applicationEnd'] = $params['applicationEnd'];
-        }
-
-        if(isset($params['auditStar']) && !empty($params['auditStar']) && isset($params['auditEnd']) && !empty($params['auditEnd'])){
-            $selectParams['auditStar'] = $params['auditStar'];
-        }
-        $export = isset($params['export']) ? $params['export'] : 0;// 导出未审核
-        $distribution = isset($params['distribution']) ? $params['distribution'] : 0; // 导出分销商
-        $modelResult = $this->objMCommissionBusinessman->getAllBusinessman($selectParams,$export,$distribution);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 查询分销商的所有下级
-     * @throws Exception
-     */
-    public function getAllSub()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'id' => isset($params['id']) ? $params['id'] : '',
-            'level' => isset($params['level']) ? $params['level'] : '',
-            'page' => isset($params['page']) ? $params['page'] : '',
-            'pageSize' => isset($params['pageSize']) ? $params['pageSize'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value) && $value !== 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        $pageParams = pageToOffset($params['page'],$params['pageSize']);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $modelResult = $this->objMCommissionBusinessman->getAllSub($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-            'subTotal' => $returnData['subTotal'],
-            'businessmanTotal' => $returnData['businessmanTotal'],
-            'subBusinessmanTotal' => $returnData['subBusinessmanTotal'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 分销商详情
-     */
-    public function getInfoBusinessman()
-    {
-        $where = [];
-        $params = $this->request->getRawJson();
-        isset($params['userCenterId']) && $where['userCenterId'] = $params['userCenterId'];
-        if(empty($where)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $modelResult = $this->objMCommissionBusinessman->getInfoBusinessman($where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 首页统计
-     */
-    public function statisticsCommissionOne()
-    {
-        $modelResult = $this->objMCommissionBusinessman->statisticsCommissionOne();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-
-    /**
-     * 首页统计(新增分销商数)
-     */
-    public function statisticsCommissionTwo()
-    {
-        $modelResult = $this->objMCommissionBusinessman->statisticsCommissionTwo();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-
-    /**
-     * 首页统计(TOP)
-     */
-    public function statisticsCommissionThree()
-    {
-        $modelResult = $this->objMCommissionBusinessman->statisticsCommissionThree();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询分销商下级人数
-     */
-    public function getBusinessmanSubLevelNum()
-    {
-        $modelResult = $this->objMCommissionBusinessman->getBusinessmanSubLevelNum();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(),$modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-}

+ 0 - 165
Controller/Commission/CommissionGoods.Class.php

@@ -1,165 +0,0 @@
-<?php
-namespace JinDouYun\Controller\Commission;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Commission\MCommissionCalculate;
-use JinDouYun\Model\Commission\MCommissionGoods;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-/**
- * 分销商品控制器
- * Description:
- * Class CommissionGoods
- */
-class CommissionGoods extends BaseController
-{
-    /**
-     * @var MCommissionGoods
-     */
-    private $objMCommissionGoods;
-
-    /**
-     * CommissionGoods constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCommissionGoods = new MCommissionGoods($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-
-    public function __destruct()
-    {
-        // TODO: Implement __destruct() method.
-    }
-
-    /**
-     * Doc: (des="分销商品列表")
-     * User: XMing
-     * Date: 2020/7/22
-     * Time: 11:56 上午
-     */
-    public function getAll()
-    {
-        $params = $this->request->getRawJson();
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $offset = ($page - 1) * $pageSize;
-        $params['limit'] = $pageSize;
-        $params['offset'] = $offset;
-        $dbResult = $this->objMCommissionGoods->getAll($params);
-        if ($dbResult->isSuccess()) {
-            $returnData = $dbResult->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total']
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
-    }
-
-    /**
-     * Doc: (des="设置商品佣金")
-     * User: XMing
-     * Date: 2020/7/22
-     * Time: 12:20 下午
-     * @example {"id":131,"isDefine":5,"isJoinCommission":5,"commission_rule":[{"skuId":1036,"rule":{"0":{"oneRate":1,"twoRate":2,"threeRate":3},"2":{"oneRate":4,"twoRate":5,"threeRate":6},"3":{"oneRate":7,"twoRate":8,"threeRate":9},"4":{"oneRate":10,"twoRate":11,"threeRate":12}}},{"skuId":1037,"rule":{"0":{"oneRate":1,"twoRate":2,"threeRate":3},"2":{"oneRate":4,"twoRate":5,"threeRate":6},"3":{"oneRate":7,"twoRate":8,"threeRate":9},"4":{"oneRate":10,"twoRate":11,"threeRate":12}}},{"skuId":1038,"rule":{"0":{"oneRate":1,"twoRate":2,"threeRate":3},"2":{"oneRate":4,"twoRate":5,"threeRate":6},"3":{"oneRate":7,"twoRate":8,"threeRate":9},"4":{"oneRate":10,"twoRate":11,"threeRate":12}}}]}
-     */
-    public function setCommission()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'id' => isset($params['id']) ? $params['id'] : null,
-            'isDefine' => isset($params['isDefine']) ? $params['isDefine'] : null,
-            'retType' => isset($params['retType']) ? $params['retType'] : StatusCode::$delete,
-            'isJoinCommission' => isset($params['isJoinCommission']) ? $params['isJoinCommission'] : null
-        ];
-        foreach ($data as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $data['commission_rule'] = isset($params['commission_rule']) ? $params['commission_rule'] : null;
-        $result = $this->objMCommissionGoods->setCommission($data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="分销商品详情")
-     * User: XMing
-     * Date: 2020/7/22
-     * Time: 12:03 下午
-     */
-    public function getInfo()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMCommissionGoods->getInfo($id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * Doc: (des="商品批量设置是否参与分销")
-     * User: XMing
-     * Date: 2020/7/22
-     * Time: 12:25 下午
-     */
-    public function updateIsJoin()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'id' => isset($params['id']) ? $params['id'] : null,
-            'isJoinCommission' => isset($params['isJoinCommission']) ? $params['isJoinCommission'] : null,
-        ];
-        foreach ($data as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCommissionGoods->updateIsJoin($data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    public function test()
-    {
-//        $obj = new MCommissionCalculate(1,1);
-//        try {
-//            //$test = $obj->createCommission(8, 891);
-//            $test = $obj->upgrade();
-//            if (!$test->isSuccess()){
-//                parent::sendOutput($test->getData(),$test->getErrorCode());
-//            }
-//            parent::sendOutput($test->getData());
-//        } catch (\Exception $e) {
-//        }
-
-        $objMCommissionGoods = new MCommissionGoods(1,1);
-        $test = $objMCommissionGoods->formatGoods([
-            [
-                'skuId' => '1027',
-                'goodsId' => '130'
-            ]
-        ]);
-        print_r($test);die;
-
-    }
-}

+ 0 - 153
Controller/Commission/CommissionGrade.Class.php

@@ -1,153 +0,0 @@
-<?php
-/**
- * 分销商等级Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Controller\Commission;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionGrade;
-
-class CommissionGrade extends BaseController
-{
-    private $objMCommissionGrade;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCommissionGrade = new MCommissionGrade($this->onlineEnterpriseId, $this->onlineUserId);
-    }
-
-    /**
-     * 获取参数
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'name' => isset($params['name']) ? $params['name'] : '',
-            'grade' => isset($params['grade']) ? $params['grade'] : '',
-            'oneRate' => isset($params['oneRate']) ? $params['oneRate'] : '',
-            'twoRate' => isset($params['twoRate']) ? $params['twoRate'] : '',
-            'threeRate' => isset($params['threeRate']) ? $params['threeRate'] : '',
-            'upgradeMode' => isset($params['upgradeMode']) ? $params['upgradeMode'] : '',
-            'upgradeCondition' => isset($params['upgradeCondition']) ? $params['upgradeCondition'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value) && $value != 0){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        return $data;
-    }
-
-    /**
-     * 新增等级
-     */
-    public function addGrade()
-    {
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionGrade->addGrade($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 删除等级
-     */
-    public function delGrade()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $update = [
-            'deleteStatus' => StatusCode::$delete
-        ];
-        $where = [
-            'id' => $id
-        ];
-        $modelResult = $this->objMCommissionGrade->updateGrade($update, $where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 修改等级
-     */
-    public function updateGrade()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionGrade->updateGrade($data, ['id' => $id]);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 等级列表
-     */
-    public function getAllGrade()
-    {
-        $modelResult = $this->objMCommissionGrade->getAllGrade();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 等级详情
-     */
-    public function getInfoGrade()
-    {
-        $id = $this->request->param('request_id');
-        if(empty($id)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $where = [
-            'id' => $id
-        ];
-        $modelResult = $this->objMCommissionGrade->getInfoGrade($where);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 升级条件
-     */
-    public function getAllGradeCondition()
-    {
-        $modelResult = $this->objMCommissionGrade->getAllGradeCondition(['type' => StatusCode::$delete]);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-}

+ 0 - 60
Controller/Commission/CommissionOrder.Class.php

@@ -1,60 +0,0 @@
-<?php
-namespace JinDouYun\Controller\Commission;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Commission\MCommissionOrder;
-use Mall\Framework\Core\ErrorCode;
-
-/**
- * Description:
- * Class CommissionOrder
- * @package JinDouYun\Controller\Commission
- */
-class CommissionOrder extends BaseController
-{
-    /**
-     * @var MCommissionOrder
-     */
-    private $objMCommissionOrder;
-
-    /**
-     * CommissionOrder constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     * @throws \Exception
-     */
-    public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMCommissionOrder = new MCommissionOrder($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-
-    /**
-     * Doc: (des="获取分销订单")
-     * User: XMing
-     * Date: 2020/7/24
-     * Time: 4:26 下午
-     */
-    public function getAll()
-    {
-        $params = $this->request->getRawJson();
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $offset = ($page - 1) * $pageSize;
-        $params['limit'] = $pageSize;
-        $params['offset'] = $offset;
-        $dbResult = $this->objMCommissionOrder->getAll($params);
-        if ($dbResult->isSuccess()) {
-            $returnData = $dbResult->getData();
-            $pageData = [
-                'pageIndex' => $page,
-                'pageSize'  => $pageSize,
-                'pageTotal' => $returnData['total']
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }
-        parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
-    }
-}

+ 0 - 134
Controller/Commission/CommissionSetting.Class.php

@@ -1,134 +0,0 @@
-<?php
-/**
- * 分销商管理Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2020/07/22
- * Time: 15:00
- */
-
-namespace JinDouYun\Controller\Commission;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionSetting;
-
-class CommissionSetting extends BaseController
-{
-    private $objMCommissionSetting;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCommissionSetting = new MCommissionSetting($this->onlineEnterpriseId, $this->onlineUserId);
-    }
-
-    /**
-     * 获取参数
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'level' => isset($params['level']) ? $params['level'] : '',
-            'self' => isset($params['self']) ? $params['self'] : '',
-            'audit' => isset($params['audit']) ? $params['audit'] : '',
-            'businessmanCondition' => isset($params['businessmanCondition']) ? $params['businessmanCondition'] : '',
-            'buyNum' => isset($params['buyNum']) ? $params['buyNum'] : '',
-            'buyAmount' => isset($params['buyAmount']) ? $params['buyAmount'] : '',
-            'buyGoods' => isset($params['buyGoods']) ? $params['buyGoods'] : '',
-            'buyCondition' => isset($params['buyCondition']) ? $params['buyCondition'] : '',
-            'image' => isset($params['image']) ? $params['image'] : '',
-            'infoStatus' => isset($params['infoStatus']) ? $params['infoStatus'] : '',
-            'info' => isset($params['info']) ? $params['info'] : '',
-            'descStatus' => isset($params['descStatus']) ? $params['descStatus'] : '',
-            'title' => isset($params['title']) ? $params['title'] : '',
-            'desc' => isset($params['desc']) ? $params['desc'] : '',
-            'subConditions' => isset($params['subConditions']) ? $params['subConditions'] : '',
-            'goods' => isset($params['goods']) ? $params['goods'] : '',
-            'mode' => isset($params['mode']) ? $params['mode'] : '',
-            'quota' => isset($params['quota']) ? $params['quota'] : '',
-            'fee' => isset($params['fee']) ? $params['fee'] : '',
-            'freeStart' => isset($params['freeStart']) ? $params['freeStart'] : '',
-            'freeEnd' => isset($params['freeEnd']) ? $params['freeEnd'] : '',
-            'day' => isset($params['day']) ? $params['day'] : '',
-            'withdrawAudit' => isset($params['withdrawAudit']) ? $params['withdrawAudit'] : '',
-            'withdrawGrade' => isset($params['withdrawGrade']) ? $params['withdrawGrade'] : '',
-            'withdrawAmount' => isset($params['withdrawAmount']) ? $params['withdrawAmount'] : '',
-            'autoPay' => isset($params['autoPay']) ? $params['autoPay'] : '',
-            'payType' => isset($params['payType']) ? $params['payType'] : '',
-            'withdrawType' => isset($params['withdrawType']) ? $params['withdrawType'] : '',
-            'withdrawInfo' => isset($params['withdrawInfo']) ? $params['withdrawInfo'] : '',
-            'leaderboard' => isset($params['leaderboard']) ? $params['leaderboard'] : '',
-        ];
-        foreach($data as $key => $value){
-            if($value === ''){
-                unset($data[$key]);
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * 保存设置
-     */
-    public function saveSetting()
-    {
-        $data = self::commonFieldFilter();
-        $modelResult = $this->objMCommissionSetting->saveSetting($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询设置
-     */
-    public function getSetting()
-    {
-        $modelResult = $this->objMCommissionSetting->getSetting();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 保存文字设置
-     */
-    public function saveTxtSetting()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data['desc'] = $params;
-        $modelResult = $this->objMCommissionSetting->saveTxtSetting($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 查询文字设置
-     */
-    public function getTxtSetting()
-    {
-        $modelResult = $this->objMCommissionSetting->getTxtSetting();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-
-}

+ 0 - 87
Controller/Commission/CommissionWithdrawals.Class.php

@@ -1,87 +0,0 @@
-<?php
-/**
- * 分销体现记录Model
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2020/07/22
- * Time: 15:00
- */
-namespace JinDouYun\Controller\Commission;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Commission\MCommissionWithdrawals;
-
-class CommissionWithdrawals extends BaseController
-{
-    private $objMCommissionWithdrawals;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMCommissionWithdrawals = new MCommissionWithdrawals($this->onlineUserId, $this->onlineEnterpriseId);
-    }
-
-    /**
-     * 获取所有的提现记录
-     */
-    public function getAll()
-    {
-        $paramsData = $this->request->getRawJson();
-
-        $selectParams = [
-            'page'     => isset($paramsData['page']) ? $paramsData['page'] : 1,
-            'pageSize' => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
-            'keyword'  => isset($paramsData['keyword']) ? $paramsData['keyword'] : 0,
-            'grade'    => isset($paramsData['grade']) ? $paramsData['grade'] : 0,
-            'type'     => isset($paramsData['type']) ? $paramsData['type'] : 0,
-            'startTime' => isset($paramsData['startTime']) ? $paramsData['startTime'] : 0,
-            'endTime' => isset($paramsData['endTime']) ? $paramsData['endTime'] : 0,
-            'auditStatus' => isset($paramsData['auditStatus']) ? $paramsData['auditStatus'] : '',
-        ];
-
-        $pageParams = pageToOffset($selectParams['page'], $selectParams['pageSize']);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $result = $this->objMCommissionWithdrawals->getAll($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $paramsData['page'],
-                'pageSize'  => $paramsData['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 修改提现记录状态
-     */
-    public function updateAuditStatus()
-    {
-        $id = $this->request->param('request_id');
-        if (!$id) {
-            parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
-        }
-
-        $status = $this->request->param('status');
-        if(!$status){
-            parent::sendOutput('请指定要修改的状态', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMCommissionWithdrawals->updateAuditStatus($id,$status);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-}

+ 0 - 225
Controller/Common/AliPayNotify.Class.php

@@ -1,225 +0,0 @@
-<?php
-/**
- * 支付宝支付通知类
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/11/28
- * Time: 5:00 PM
- */
-namespace JinDouYun\Controller\Common;
-
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Order\MOrder;
-use JinDouYun\Model\Market\MVipCard;
-
-class AliPayNotify extends BaseController
-{
-    //使用文件读取文件格式,请只传递该值(支付宝公钥文件方式)
-    private $alipayPublicKey = null;
-
-    //使用读取字符串格式,请只传递该值(支付宝公钥字符串方式)
-    private $alipayrsaPublicKey;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-
-        $this->alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnb7lP7zW4CR94yAgljj4yNc4j7NyWd7oGhCB5/0PBcg9QQ91bj4dAUMFyu/QNJK2ez2jqVUoDeB13ueOVxwBfINwLm4k6Kw5PnDkSJBuGyE9bUQDEPOpm3/UZmza86uvm5xce54gyn+9OqH0Z4iWt4CuVAG4IwwAaVVhNLwxJQAiKWHYtNzWHtvNQV81CFEJinnV8u1sh40ex0FZlnjcyvSwzOILVqEsLYUaXpp0XDnk9j1yC+sVSAjezIQUplptWuGBnMiA2Q5nZtryNm+BaaVV0wNCs5wTUr4hfvxcw4UitkNEwJTVKp2JUYMgNV8JuX+y/MEIASN8nMiL+rDzYwIDAQAB';
-
-    }
-
-    /**
-     * 支付宝回调处理方法
-     * 官网文档地址:https://docs.open.alipay.com/204/105301/
-     * @throws \Exception
-     */
-    public function notify()
-    {
-        $flag = $this->rsaCheckV1($_POST, NULL, "RSA2");
-        //验签
-        if($flag){
-            //处理业务,并从$_POST中提取需要的参数内容
-            if($_POST['trade_status'] == 'TRADE_SUCCESS' || $_POST['trade_status'] == 'TRADE_FINISHED'){ // 处理交易完成或者支付成功的通知
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/alipay.log',date('Y-m-d H:i:s').'回调数据'.var_export($_POST,true).PHP_EOL,FILE_APPEND);
-                $passback_params = urldecode($_POST['passback_params']); // 回传参数
-                $attach = explode('|',$passback_params);
-
-                if(empty($attach)){
-                    exit('fail');
-                }
-
-                $enterpriseId = $attach[0];
-                unset($attach[0]);
-                $userCentId = $attach[1];
-                unset($attach[1]);
-
-                $allOrdersId = array_values($attach);
-
-                if (strpos( $_POST['out_trade_no'],'tmp') === false || substr($_POST['out_trade_no'],0,3) == 'tmp') {
-                    $updateOrderData = [
-                        'outerTradeNo' => $_POST['trade_no'], // 该交易在支付宝系统中的交易流水号
-                        'payType' => StatusCode::$payType['aliPay'],
-                        'payStatus' => StatusCode::$standard,
-                        'orderStatus' => StatusCode::$orderStatus['waitDelivery'],
-                        'payTime' => strtotime($_POST['gmt_payment']), // 支付完成时间
-                        'total_fee'=> $_POST['total_amount'],//支付金额
-                        'pay_way'=>StatusCode::$payType['aliPay']
-                    ];
-
-                    $objMOrder = new MOrder($userCentId, $enterpriseId);
-                    if(strpos( $_POST['out_trade_no'],'tmp') === false){
-                        $result = $objMOrder->updateOrderPayData($updateOrderData, ['id'=>$allOrdersId,'no'=>$_POST['out_trade_no']],true);
-
-                    }else{
-                        $result = $objMOrder->updateOrderPayData($updateOrderData, ['id'=>$allOrdersId,'outerTradeNo'=>$_POST['out_trade_no']],true);
-                    }
-
-                    if(!$result->isSuccess()){
-                        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/alipay.log',date('Y-m-d H:i:s').'修改订单状态失败'.var_export($result->getData(),true).PHP_EOL,FILE_APPEND);
-                        exit('fail');
-                    }else{
-                        exit('success');// 响应success表示业务处理成功,告知支付宝无需在异步通知
-                    }
-                }
-
-                //处理会员卡订单
-                if (strpos( $_POST['out_trade_no'],'tmp') !== false && substr($_POST['out_trade_no'],0,3) == 'vip') {
-                    $vipOrderData = [
-                        'outerTradeNo' => $_POST['trade_no'],
-                        'payType' => StatusCode::$payType['aliPay'],
-                        'payStatus' => StatusCode::$standard,
-                        'payTime' => strtotime($_POST['gmt_payment']), // 支付完成时间
-                    ];
-
-                    $objMVipCard = new MVipCard($enterpriseId, $userCentId);
-
-                    $result = $objMVipCard->updateVipOrderPayData($vipOrderData, ['id'=>$allOrdersId,'outerTradeNo'=>$_POST['out_trade_no']],true);
-
-
-                    if(!$result->isSuccess()){
-                        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/alipay.log',date('Y-m-d H:i:s').'修改会员卡订单状态失败'.var_export($result->getData(),true).PHP_EOL,FILE_APPEND);
-                        exit('fail');
-                    }else{
-                        exit('success');// 响应success表示业务处理成功,告知支付宝无需在异步通知
-                    }
-                }
-
-                exit('fail');
-
-            }else{
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/alipay.log',date('Y-m-d H:i:s').'状态错误'.var_export($_POST,true).PHP_EOL,FILE_APPEND);
-            }
-        }else{
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/alipay.log',date('Y-m-d H:i:s').'签名验证失败'.var_export($_POST,true).PHP_EOL,FILE_APPEND);
-        }
-    }
-
-
-    /** rsaCheckV1 & rsaCheckV2
-     *  验证签名
-     *  在使用本方法前,必须初始化AopClient且传入公钥参数。
-     *  公钥是否是读取字符串还是读取文件,是根据初始化传入的值判断的。
-     **/
-    public function rsaCheckV1($params, $rsaPublicKeyFilePath,$signType='RSA') {
-        $sign = $params['sign'];
-        $params['sign_type'] = null;
-        $params['sign'] = null;
-        return $this->verify($this->getSignContent($params), $sign, $rsaPublicKeyFilePath,$signType);
-    }
-
-    public function getSignContent($params) {
-        ksort($params);
-
-        $stringToBeSigned = "";
-        $i = 0;
-        foreach ($params as $k => $v) {
-            if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
-
-                // 转换成目标字符集
-                $v = $this->characet($v, "UTF-8");
-
-                if ($i == 0) {
-                    $stringToBeSigned .= "$k" . "=" . "$v";
-                } else {
-                    $stringToBeSigned .= "&" . "$k" . "=" . "$v";
-                }
-                $i++;
-            }
-        }
-
-        unset ($k, $v);
-        return $stringToBeSigned;
-    }
-
-    /**
-     * 校验$value是否非空
-     *  if not set ,return true;
-     *    if is null , return true;
-     **/
-    protected function checkEmpty($value)
-    {
-        if (!isset($value))
-            return true;
-        if ($value === null)
-            return true;
-        if (trim($value) === "")
-            return true;
-
-        return false;
-    }
-
-    /**
-     * 转换字符集编码
-     * @param $data
-     * @param $targetCharset
-     * @return string
-     */
-    function characet($data, $targetCharset)
-    {
-        if (!empty($data)) {
-            $fileType = "UTF-8";
-            if (strcasecmp($fileType, $targetCharset) != 0) {
-                $data = mb_convert_encoding($data, $targetCharset, $fileType);
-                //				$data = iconv($fileType, $targetCharset.'//IGNORE', $data);
-            }
-        }
-
-        return $data;
-    }
-
-    function verify($data, $sign, $rsaPublicKeyFilePath, $signType = 'RSA')
-    {
-
-        if($this->checkEmpty($this->alipayPublicKey)){
-
-            $pubKey= $this->alipayrsaPublicKey;
-            $res = "-----BEGIN PUBLIC KEY-----\n" .
-                wordwrap($pubKey, 64, "\n", true) .
-                "\n-----END PUBLIC KEY-----";
-        }else {
-            //读取公钥文件
-            $pubKey = file_get_contents($rsaPublicKeyFilePath);
-            //转换为openssl格式密钥
-            $res = openssl_get_publickey($pubKey);
-        }
-
-        ($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确');
-
-        //调用openssl内置方法验签,返回bool值
-
-        if ("RSA2" == $signType) {
-            $result = (bool)openssl_verify($data, base64_decode($sign), $res, OPENSSL_ALGO_SHA256);
-        } else {
-            $result = (bool)openssl_verify($data, base64_decode($sign), $res);
-        }
-
-        if(!$this->checkEmpty($this->alipayPublicKey)) {
-            //释放资源
-            openssl_free_key($res);
-        }
-
-        return $result;
-    }
-}

+ 0 - 57
Controller/Common/ApiTestCom.Class.php

@@ -1,57 +0,0 @@
-<?php
-/**
- * 测试
- * Created by PhpStorm.
- * Date=> 2020/05/16
- * Time=> 11=>31
- */
-
-namespace JinDouYun\Controller\Common;
-
-
-use JinDouYun\Controller\BaseController;
-use Util\Common\PartnerTools;
-use Util\Common\AgentTools;
-
-
-
-
-class ApiTestCom  extends BaseController
-{
-
-   public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-    }
-
-
-    public function tool()
-    {
-        
-        echo "企业:".$this->onlineEnterpriseId.PHP_EOL;
-//        $to = new PartnerTools($this->onlineEnterpriseId);
-        $to = new AgentTools($this->onlineEnterpriseId);
-        
-        //缓存测试
-//        echo $to->cacheTest();
-        
-        //绑定下级测试
-//        var_dump($to->setPushCustomer(24,25));
-        
-
-        
-        //添加任务测试
-        
-//        var_dump($to->addTask("78",$this->onlineEnterpriseId));
-//        var_dump($to->addTask("87",$this->onlineEnterpriseId));
-//        var_dump($to->addTask("88",$this->onlineEnterpriseId));
-        
-        //执行任务测试
-        var_dump($to->runTaskNew());
-        
-        //子级查询测试
-        
-//        var_dump($to->getApiChildrenTree(17));
-        
-    }
-}

+ 0 - 172
Controller/Common/CloudPrint.Class.php

@@ -1,172 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2020/6/17
- * Time: 4:07 PM
- */
-
-namespace JinDouYun\Controller\Common;
-
-use Jindouyun\Cache\EnterpriseCache;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-use JinDouYun\Controller\BaseController;
-
-use Util\CloudPrint\Gainshca;
-use Util\CloudPrint\Feie;
-
-
-class CloudPrint extends BaseController
-{
-    private $objEnterpriseCache;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    /**
-     * 佳博打印机添加设备
-     */
-    public function adddev()
-    {
-        //$gainshcaConfigData = Factory::config()->getAppoint('cloudPrint','gainshca');
-        $gainshcaConfigData = self::getConfig();
-        if(empty($gainshcaConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-        $objGainshca = new Gainshca($gainshcaConfigData['memberCode'], $gainshcaConfigData['deviceID'], $gainshcaConfigData['apiKey']);
-        $result = $objGainshca->adddev();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 由于此方法在model层调用,所以传递一个企业id
-     * @param $msgDetail
-     * @param $onlineEnterpriseId
-     */
-    public function sendMsg($msgDetail,$onlineEnterpriseId)
-    {
-        $this->onlineEnterpriseId = $onlineEnterpriseId;
-        //$gainshcaConfigData = Factory::config()->getAppoint('cloudPrint','gainshca');
-        $gainshcaConfigData = self::getConfig();
-        if(empty($gainshcaConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-        $objGainshca = new Gainshca($gainshcaConfigData['memberCode'], $gainshcaConfigData['deviceID'], $gainshcaConfigData['apiKey']);
-        $result = $objGainshca->sendMsg($msgDetail);
-        if ($result->isSuccess()) {
-            return ResultWrapper::success('success');
-            //parent::sendOutput($result->getData());
-        } else {
-            return ResultWrapper::fail($result->getData(),$result->getErrorCode());
-            //parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 查询打印机设备
-     * return deviceID设备id  online在线状态(0离线1在线) status状态(1正常 2缺纸 3其他异常 4过热 5开盖 8暂停 9打印中) outtime最后一次离线时间 printnum累计打印次数
-     * @param bool $deviceID //打印机id
-     * @param bool $selectAll //是否查询所有打印机
-     */
-    public function getStatus($deviceID = false, $selectAll = false)
-    {
-        //$gainshcaConfigData = Factory::config()->getAppoint('cloudPrint','gainshca');
-        $gainshcaConfigData = self::getConfig();
-        if(empty($gainshcaConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-        $objGainshca = new Gainshca($gainshcaConfigData['memberCode'], $gainshcaConfigData['deviceID'], $gainshcaConfigData['apiKey']);
-
-        $result = $objGainshca->getStatus($deviceID, $selectAll);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 设置打印机音量
-     * @param $num
-     */
-    public function setVolume($num)
-    {
-        //$gainshcaConfigData = Factory::config()->getAppoint('cloudPrint','gainshca');
-        $gainshcaConfigData = self::getConfig();
-        if(empty($gainshcaConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-        $objGainshca = new Gainshca($gainshcaConfigData['memberCode'], $gainshcaConfigData['deviceID'], $gainshcaConfigData['apiKey']);
-
-        $result = $objGainshca->setVolume($num);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 获取打印机配置项
-     * @return array
-     */
-    public function getConfig()
-    {
-        $objEnterpriseCache = new EnterpriseCache();
-        $cache = $objEnterpriseCache->getEnterpriseSetting($this->onlineEnterpriseId);
-        if (empty($cache)){
-            return [];
-        }
-        return [
-            'memberCode' => isset($cache['memberCode']) ? $cache['memberCode'] : '',
-            'deviceID'   => isset($cache['deviceID']) ? $cache['deviceID'] : '',
-            'apiKey'     => isset($cache['apiKey']) ? $cache['apiKey'] : '',
-        ];
-
-    }
-
-
-
-
-    /**************************************飞鹅打印机 *******************************************/
-
-    /**
-     * 添加打印机
-     */
-    public function addFeieDev()
-    {
-        $objFeie = new Feie('930534909', '8gh4jctw');
-        $result = $objFeie->adddev();
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 发送打印机信息
-     * @param $params
-     */
-    public function feieSendMsg($params)
-    {
-        $objFeie = new Feie('930534909', '8gh4jctw');
-        $result = $objFeie->sendMsg($params);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-}

+ 0 - 42
Controller/Common/Common.Class.php

@@ -1,42 +0,0 @@
-<?php
-/**
-* 公共类
-* Created by PhpStorm.
-* User: 小威
-* Date: 2019/11/04
-* Time: 10:40
-*/
-namespace Jindouyun\Controller\Common;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Factory;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\UserCenter\MUserCenterLogin;
-
-class Common extends BaseController
-{
-    private $objMUserCenterLogin;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken = false);
-        $this->objMUserCenterLogin = new MUserCenterLogin();
-    }
-
-    /**
-     * 刷新token方法
-     */
-    public function flushToken()
-    {
-        $result = $this->objMUserCenterLogin->flushToken($this->onlineUserId);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-}

+ 0 - 1251
Controller/Common/ESinit.Class.php

@@ -1,1251 +0,0 @@
-<?php
-/**
- * ES初始化类 创建映射
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/8
- * Time: 14:47
- */
-
-namespace Jindouyun\Controller\Common;
-
-use Mall\Framework\Core\Config;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\Request;
-
-class ESInit
-{
-    private $request;
-
-    public function __construct()
-    {
-        $this->request = Request::getInstance();
-    }
-
-    public function search($s = 0)
-    {
-
-        if ($s) {
-            $c = intval($s);
-        } else {
-            $data = Request::params();
-            $c = $data['b'] ?: 1;
-        }
-
-        switch ($c) {
-            //添加商品索引库
-            case 1:
-                $mappings = array(
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'basicGoodsId' => ["type" => "integer"],//关联商品基本资料id,
-                                'id'           => ["type" => "integer"],//商品id,
-                                'enterpriseId' => ['type' => 'integer'],//enterpriseId,
-                                'shopId'       => ["type" => "integer"],//'商铺id',
-                                'warehouseId'  => ["type" => "integer"],//'仓库id',
-                                'images'       => [
-                                    'type' => 'text'
-                                ],
-                                'serviceInfo'  => ["type" => "integer"],//'服务保证',
-                                'salesNum'     => [
-                                    "properties" => [
-                                        "skuId"    => ["type" => "integer",],
-                                        "salesNum" => ["type" => "integer",],
-                                    ]
-                                ],//销量
-                                'content'      => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'商品详情',
-                                'extend'       => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],// '扩展字段',
-                                'sort'         => ["type" => "integer"],//'排序',
-                                'isRecommend'  => ["type" => "integer"],//是否推荐(5是   4否)',
-                                'deleteStatus' => ["type" => "integer"],//删除状态(5未删除   4已删除)',
-                                'enableStatus' => ["type" => "integer"],//上下架(5上架   4下架)',
-                                'createTime'   => [
-                                    'type' => 'integer',
-
-                                ],//'创建时间'
-                                'updateTime'   => [
-                                    'type' => 'integer',
-                                ],//'修改时间',
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('goods_search');
-                $result = $searchServer->createBase('online_goods_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_goods_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除商品索引库
-            case 2:
-                $searchServer = Factory::search('goods_search');
-                $searchServer->setIndex('online_goods_search');
-                $a = $searchServer->deleteBase('online_goods_search');
-                print_r($a);
-                break;
-            //添加客户索引库
-            case 3:
-                $mappings = array(
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'             => ['type' => 'integer'],//customerId,
-                                'userCenterId'   => ['type' => 'integer'],//userCenterId,
-                                'mobile'         => ['type' => 'keyword'],
-                                'source'         => ['type' => 'integer'],//客户来源
-                                'enterpriseId'   => ['type' => 'integer'],//enterpriseId,
-                                'status'         => ['type' => 'integer'],//'账号状态(1已审核  2待审核)',
-                                'statusName'     => ['type' => 'keyword'],//状态名称,
-                                'name'           => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'客户名称',
-                                'code'           => ['type' => 'keyword'],//'客户编码',
-                                'type'           => ['type' => 'integer'],//'客户类型',
-                                'provinceCode'   => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址省编码',
-                                'cityCode'       => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址市编码',
-                                'districtCode'   => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '客户地址区编码',
-                                'provinceName'   => ['type' => 'keyword'],//省名称
-                                'cityName'       => ['type' => 'keyword'],//市名称
-                                'districtName'   => ['type' => 'keyword'],//区名称
-                                "address"        => [
-                                    "type"            => "text",
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],
-                                'managerMobile'  => ['type' => 'keyword'],//'负责人电话',
-                                'shopId'         => ['type' => 'integer'],//商铺id,
-                                'shopName'       => ['type' => 'keyword'],//商铺名称,
-                                'departmentId'   => ['type' => 'integer'],//销售部Id,
-                                'departmentName' => ['type' => 'keyword'],//部门名称,
-                                'salesManId'     => ['type' => 'integer'],//int(10) DEFAULT NULL COMMENT '业务员id',
-                                'salesManCode'   => ['type' => 'keyword'],//'业务员编码',
-                                'salesManName'   => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'业务员名称',
-                                'birthday'       => [
-                                    'type' => 'integer'
-                                ],//'客户生日',
-                                'enableStatus'   => ['type' => 'integer'],//'启用状态(5启用  4禁用)',
-                                'deleteStatus'   => ['type' => 'integer'],//'删除状态(5未删除   4已删除)',
-                                'createTime'     => ['type' => 'integer'],//'创建时间'
-                                'updateTime'     => ['type' => 'integer'],//'修改时间',
-                                'extend'         => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],// '扩展字段',
-                                'tag'            => [// '客户标签',
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],
-                                'remark'         => [
-                                    "type"            => "text",
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word",
-                                ],// '备注'
-                                'location'       => [
-                                    "type" => "geo_point",
-                                ],//经纬度
-                                'contact'        => [
-                                    "properties" => [
-                                        "name"   => ["type" => "keyword",],
-                                        "mobile" => ["type" => "keyword",],
-                                    ]
-                                ],// '联系人'
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('customer_search');
-                $result = $searchServer->createBase('online_customer_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_customer_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除客户索引库
-            case 4:
-                $searchServer = Factory::search('customer_search');
-                $searchServer->setIndex('online_customer_search');
-                $a = $searchServer->deleteBase('online_customer_search');
-                print_r($a);
-                break;
-            //添加商品基本资料
-            case 5:
-                //创建映射
-                $mappings = array(
-                    "settings" => [
-                        "analysis" => [
-                            "analyzer" => [
-                                "comma"=>[
-                                    "type" => "pattern",
-                                    "pattern" => ","
-                                ]
-                            ]
-                        ]
-                    ],
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],//商品基本资料id,
-                                'enterpriseId' => ['type' => 'integer'],//enterpriseId,
-                                'images'       => ['type' => 'text'],
-                                'title'        => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//商品名称,
-                                'code'         => ["type" => "keyword"],
-                                'barCode'      => ["type" => "keyword"],
-                                'categoryId'   => ["type" => "integer"],//'商品分类id',
-                                'expireTime'   => ["type" => "integer"],//'过期时间',
-                                'brandId'      => ["type" => "integer"],//'品牌id',
-                                'tag'          => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'关键词',
-                                'description'  => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'商品详情',
-                                'noSalesShop'  => ['type' => 'text'],//'禁止销售店铺',
-                                'extends'      => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//'拓展字段',
-                                'enableStatus' => ["type" => "integer"],//'商品状态  默认5 上线 6下线',
-                                'deleteStatus' => ["type" => "integer"],//'是否删除 4 删除 5正常',
-                                'createTime'   => [
-                                    'type' => 'integer',
-                                ],//'创建时间'
-                                'updateTime'   => [
-                                    'type' => 'integer',
-                                ],//'修改时间',
-                                'categoryPath' => [
-                                    "type"            => "text",
-                                    "analyzer"        => "comma",
-                                    "search_analyzer" => "comma"
-                                ],//'分类路径',
-                                'skuData'      => [
-                                    "properties" => [
-                                        "masterUnit" => [
-                                            "properties" => [
-                                                "id"           => ["type" => "integer",],
-                                                "unitName"     => ["type" => "keyword",],
-                                                "unitId"       => ["type" => "integer",],
-                                                "isMaster"     => ["type" => "integer",],
-                                                "deleteStatus" => ["type" => "integer",],
-                                            ]
-                                        ],
-                                        "branchUnit" => [
-                                            "properties" => [
-                                                "id"           => ["type" => "integer",],
-                                                "unitName"     => ["type" => "keyword",],
-                                                "unitId"       => ["type" => "integer",],
-                                                "isMaster"     => ["type" => "integer",],
-                                                "deleteStatus" => ["type" => "integer",],
-                                            ]
-                                        ]
-
-                                    ]
-                                ],//sku
-                            ],
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('goods_basic_search');
-                $result = $searchServer->createBase('goods_basic_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_goods_basic_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除商品基本资料索引库
-            case 6:
-                $searchServer = Factory::search('goods_basic_search');
-                $searchServer->setIndex('goods_basic_search');
-                $a = $searchServer->deleteBase('online_goods_basic_search');
-                print_r($a);
-                break;
-            //创建订单索引库
-            case 7:
-                $mappings = array(
-                    'mappings' => array(
-                        "order" => [
-                            "properties" => [
-                                /*订单表信息*/
-                                'id'           => ["type" => "integer"],//订单id,
-                                'no'           => ["type" => "keyword"],//订单编号,
-                                'outerTradeNo' => ['type' => 'keyword'],//'外部流水号(支付宝/微信返回的流水号)'
-                                'shopId'       => ['type' => 'integer'],//商铺id
-                                'userCenterId' => ['type' => 'integer'],//用户id
-                                'enterpriseId' => ['type' => 'integer'],//企业id
-                                'customerType' => ['type' => 'integer'],//客户类型
-                                'totalMoney'   => [
-                                    'type'           => 'scaled_float',
-                                    'scaling_factor' => 100
-                                ],//'总金额',
-                                'payAmount'    => [
-                                    'type'           => 'scaled_float',
-                                    'scaling_factor' => 100
-                                ],//实付金额
-                                'buyTotal'     => ["type" => "integer"],//购买总数
-                                'customerName' => ["type" => "keyword"],//客户姓名
-                                'customerId'   => ["type" => "integer"],//客户id
-                                'payStatus'    => ["type" => "integer"],//'支付状态  默认1 未支付 2已支付'
-                                'orderStatus'  => ["type" => "integer"],//订单状态 默认1 创建 2待支付 3代发货 4待收货 5已完成 6已关闭
-                                'payType'      => ["type" => "integer"],//'支付方式 1微信 2支付宝 3货到付款 4上门自提'
-                                'deliveryType' => ["type" => "integer"],//'配送方式 1商品配送 2上门自提'
-                                'source'       => ["type" => "integer"],//订单来源 默认1 ios 2android 3小程序 4后台创建
-                                'remark'       => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//订单备注
-                                'auditStatus'  => ["type" => "integer"],// '审核状态 默认1 待审 2审核通过 3 审核未通过 4 审核中'
-                                'payTime'      => [
-                                    'type' => 'integer',
-                                    /**/
-                                ],//'付款时间'
-                                'createTime'   => [
-                                    'type' => 'integer',
-                                ],//'创建时间'
-                                'updateTime'   => [
-                                    'type' => 'integer',
-                                ],//'修改时间',
-
-                                'salesManId'   => ["type" => "integer"],//业务员id
-                                'salesManName' => ["type" => "keyword"],//业务员名称
-
-                                /*收货人信息*/
-                                'realName'     => ["type" => "keyword"],//收货人姓名
-                                'mobile'       => ["type" => "keyword"],//收货人电话
-                                'address'      => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//收货详细地址
-                                'provinceCode' => ["type" => "integer"],//收货人省份编码
-                                'cityCode'     => ["type" => "integer"],//收货人城市编码
-                                'districtCode' => ["type" => "integer"],//收货人区编码
-                                'goodsName'    => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('order_search');
-                $result = $searchServer->createBase('online_order_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_order_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除订单索引库
-            case 8:
-                $searchServer = Factory::search('order_search');
-                $searchServer->setIndex('online_order_search');
-                $a = $searchServer->deleteBase('online_order_search');
-                print_r($a);
-                break;
-            //添加商铺索引库
-            case 9:
-                //创建映射
-                $mappings = array(
-                    "settings" => [
-                        "analysis" => [
-                            "analyzer" => [
-                                "comma"=>[
-                                    "type" => "pattern",
-                                    "pattern" => ","
-                                ]
-                            ]
-                        ]
-                    ],
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],//商铺id,
-                                'enterpriseId' => ['type' => 'integer'],//enterpriseId,
-                                'name'         => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],//商铺名称,
-                                'logo'         => ['type' => 'text'],//商铺logo,
-                                'shopCode'     => ['type' => 'text'],//商铺仓库编码,
-                                'shopType'     => ['type' => 'integer'],//商铺类型,
-                                'openTime'     => [
-                                    "properties" => [
-                                        "start"    => ["type" => "text",],
-                                        "end"      => ["type" => "text",],
-                                        "isAllDay" => ["type" => "integer",],
-                                    ]
-                                ],//营业时间
-                                'contactName'  => ['type' => 'keyword'],//联系人,
-                                'mobile'       => ['type' => 'keyword'],//联系电话,
-                                'deleteStatus' => ["type" => "integer"],//删除状态(5未删除   4已删除)',
-                                'enableStatus' => ["type" => "integer"],//启用状态(4未启用 5已启用)
-                                'createTime'   => [
-                                    'type' => 'integer',
-
-                                ],//'创建时间'
-                                'updateTime'   => [
-                                    'type' => 'integer',
-                                ],//'修改时间',
-
-                                'provinceCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址省编码',
-                                'cityCode'     => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址市编码',
-                                'districtCode' => ['type' => 'keyword'],//varchar(20) NOT NULL COMMENT '商铺地址区编码',
-                                'provinceName' => ['type' => 'keyword'],//商铺省名称
-                                'cityName'     => ['type' => 'keyword'],//商铺市名称
-                                'districtName' => ['type' => 'keyword'],//商铺区名称
-                                "address"      => [
-                                    "type"            => "text",
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],
-                                'location'     => [
-                                    "type" => "geo_point",
-                                ],//经纬度
-                                'salesArea'    => [
-                                    "type"            => "text",
-                                    "analyzer"        => "comma",
-                                    "search_analyzer" => "comma"
-                                ],//'销售区域',
-                            ],
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('shop_search');
-                $result = $searchServer->createBase('online_shop_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_shop_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除商铺索引库
-            case 10:
-                $searchServer = Factory::search('shop_search');
-                $searchServer->setIndex('online_shop_search');
-                $a = $searchServer->deleteBase('online_shop_search');
-                print_r($a);
-                break;
-            //添加登录日志索引库
-            case 11:
-                //创建映射
-                $mappings = array(
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],
-                                'userCenterId' => ['type' => 'integer'],
-                                'enterpriseId' => ['type' => 'integer'],//enterpriseId,
-                                'mobile'       => ['type' => 'keyword'],//联系电话,
-                                'createTime'   => [
-                                    'type' => 'integer',
-
-                                ],//'创建时间'
-                                'source'       => [
-                                    'type' => 'keyword',
-                                ],
-                                'actionType'   => [
-                                    'type' => 'keyword',
-                                ]
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('login_log');
-                $result = $searchServer->createBase('online_login_log', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_login_log init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除登录日志
-            case 12:
-                $searchServer = Factory::search('login_log');
-                $searchServer->setIndex('online_login_log');
-                $a = $searchServer->deleteBase('online_login_log');
-                print_r($a);
-                break;
-            //添加日志索引库
-            case 13:
-                //创建映射
-                $mappings = array(
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],
-                                'userCenterId' => ['type' => 'integer'],
-                                'enterpriseId' => ['type' => 'integer'],//enterpriseId,
-                                'createTime'   => [
-                                    'type' => 'integer',
-
-                                ],//'创建时间'
-                                'no'           => [
-                                    'type'            => 'text',
-                                    "analyzer"        => "ik_max_word",
-                                    "search_analyzer" => "ik_max_word"
-                                ],
-                                'actionType'   => [
-                                    'type' => 'keyword',
-                                ]
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('logs');
-                $result = $searchServer->createBase('online_logs', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_logs init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除日志
-            case 14:
-                $searchServer = Factory::search('logs');
-                $searchServer->setIndex('online_logs');
-                $a = $searchServer->deleteBase('online_logs');
-                print_r($a);
-                break;
-            //入库列表
-            case 15:
-                $mappings = array(
-                    'mappings' => array(
-                        "inventory_in" => [
-                            "properties" => [
-                                //入库表信息
-                                'id'            => ["type" => "integer"],//入库id
-                                'no'            => ["type" => "keyword"],//入库编号
-                                'sourceNo'      => ['type' => 'keyword'],//来源单号
-                                'materielNum'   => ['type' => 'integer'],//商品数量
-                                'amount'        => ['type' => 'scaled_float', 'scaling_factor' => 100],//总金额
-                                'warehouseId'   => ['type' => 'integer'],//仓库id
-                                'warehouseName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
-                                'operatorId'    => ['type' => 'integer'],//操作人id
-                                'operatorName'  => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
-                                'auditId'       => ['type' => 'integer'],//审核人id
-                                'auditName'     => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
-                                'remark'        => ['type' => 'text'],//备注
-                                'deleteStatus'  => ['type' => 'integer'],//删除状态
-                                'source'        => ['type' => 'integer'],//来源
-                                'type'          => ['type' => 'integer'],
-                                'auditStatus'   => ['type' => 'integer'],//审核状态
-                                'auditTime'     => ['type' => 'integer'],//审核日期
-                                'createTime'    => ['type' => 'integer'],//创建时间
-                                'updateTime'    => ['type' => 'integer'],//更新时间
-                            ],
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('inventory_in_search');
-                $result = $searchServer->createBase('online_inventory_in_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_inventory_in_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除入库
-            case 16:
-                $searchServer = Factory::search('inventory_in_search');
-                $searchServer->setIndex('online_inventory_in_search');
-                $a = $searchServer->deleteBase('online_inventory_in_search');
-                print_r($a);
-                break;
-            //出库列表
-            case 17:
-                $mappings = array(
-                    'mappings' => array(
-                        "inventory_out" => [
-                            "properties" => [
-                                //入库表信息
-                                'id'             => ["type" => "integer"],//入库id
-                                'no'             => ["type" => "keyword"],//入库编号
-                                'sourceNo'       => ['type' => 'keyword'],//来源单号
-                                'materielNum'    => ['type' => 'integer'],//商品数量
-                                'amount'         => ['type' => 'scaled_float', 'scaling_factor' => 100],//总金额
-                                'warehouseId'    => ['type' => 'integer'],//仓库id
-                                'warehouseName'  => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
-                                'operatorId'     => ['type' => 'integer'],//操作人id
-                                'operatorName'   => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
-                                'auditId'        => ['type' => 'integer'],//审核人id
-                                'auditName'      => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
-                                'customerId'     => ['type' => 'integer'],
-                                'customerName'   => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'customerCode'   => ['type' => 'text'],
-                                'customerMobile' => ['type' => 'keyword'],
-                                'remark'         => ['type' => 'text'],//备注
-                                'deleteStatus'   => ['type' => 'integer'],//删除状态
-                                'source'         => ['type' => 'integer'],//来源
-                                'type'           => ['type' => 'integer'],
-                                'auditStatus'    => ['type' => 'integer'],//审核状态
-                                'auditTime'      => ['type' => 'integer'],//审核日期
-                                'createTime'     => ['type' => 'integer'],//创建时间
-                                'updateTime'     => ['type' => 'integer'],//更新时间
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('inventory_out_search');
-                $result = $searchServer->createBase('online_inventory_out_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_inventory_out_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除出库
-            case 18:
-                $searchServer = Factory::search('inventory_out_search');
-                $searchServer->setIndex('online_inventory_out_search');
-                $a = $searchServer->deleteBase('online_inventory_out_search');
-                print_r($a);
-                break;
-            //商品调价单
-            case 19:
-                $mappings = array(
-                    'mappings' => array(
-                        "priceAdjustmentSheet" => [
-                            "properties" => [
-                                /*订单表信息*/
-                                'enterpriseId'      => ['type' => 'integer'],//enterpriseId,
-                                'id'                => ["type" => "integer"],//自增id,
-                                'no'                => ["type" => "keyword"],//调价单号,
-                                'goodsCode'         => ['type' => 'keyword'],//商品编号
-                                'goodsName'         => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//商品名称
-                                'goodsId'           => ['type' => 'integer'],//商品id
-                                'saleType'          => ['type' => 'integer'],//销售类型 1实物销售 2虚库销售
-                                'salePriceAreaType' => ['type' => 'integer'],//销售价格生效区域类型 1全国统一价 2大区价
-                                'salePriceType'     => ['type' => 'integer'],//销售价格类型 1销售价格 2秒杀活动价
-                                'shopId'            => ['type' => 'integer'],//店铺id
-                                'shopName'          => ['type' => 'keyword'],//店铺名称
-                                'cargoOwnerCode'    => ['type' => 'keyword'],//货主编码
-                                'createUserId'      => ['type' => 'integer'],//创建人id
-                                'createUserName'    => ['type' => 'keyword'],//创建人姓名
-                                'effectiveUserName' => ['type' => 'keyword'],//生效人姓名
-                                'effectiveUserId'   => ['type' => 'integer'],//生效人id
-                                'deleteStatus'      => ['type' => 'integer'],//删除状态 4删除 5正常
-                                'effectiveStatus'   => ['type' => 'integer'],//生效状态 1.待审 2审核通过 3未通过 4审核中
-                                'createTime'        => ['type' => 'integer',],//创建时间
-                                'updateTime'        => ['type' => 'integer',],//修改时间
-                                'salePrice'         => [
-                                    "properties" => [
-
-                                    ]
-                                ],//销售价格
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('priceAdjustmentSheet_search');
-                $result = $searchServer->createBase('online_priceadjustmentsheet_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_priceadjustmentsheet_search init done.';
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除商品调价单
-            case 20:
-                $searchServer = Factory::search('priceAdjustmentSheet_search');
-                $searchServer->setIndex('online_priceadjustmentsheet_search');
-                $a = $searchServer->deleteBase('online_priceadjustmentsheet_search');
-                print_r($a);
-                break;
-            //调拨列表
-            case 21:
-                $mappings = array(
-                    'mappings' => array(
-                        "allocate" => [
-                            "properties" => [
-                                //入库表信息
-                                'id'            => ["type" => "integer"],//入库id
-                                'no'            => ["type" => "keyword"],//入库编号
-                                'warehouseId'   => ['type' => 'integer'],//仓库id
-                                'inWarehouseId' => ['type' => 'integer'],//in仓库id
-                                'warehouseName' => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//仓库名称
-                                'operatorId'    => ['type' => 'integer'],//操作人id
-                                'operatorName'  => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//操作人name
-                                'auditId'       => ['type' => 'integer'],//审核人id
-                                'auditName'     => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"], //审核人name
-                                'remark'        => ['type' => 'text'],//备注
-                                'deleteStatus'  => ['type' => 'integer'],//删除状态
-                                'auditStatus'   => ['type' => 'integer'],//审核状态
-                                'auditTime'     => ['type' => 'integer'],//审核日期
-                                'createTime'    => ['type' => 'integer'],//创建时间
-                                'updateTime'    => ['type' => 'integer'],//更新时间
-                                'linkId'        => ["type" => "integer"],
-                                'materielId'    => ["type" => "integer"],
-                                'materielName'  => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'materielCode'  => ["type" => "text"],
-                                'skuId'         => ["type" => "integer"],
-                                'num'           => ["type" => "double"],
-                                'costUnitPrice' => ["type" => "double"],
-                                'batch'         => ["type" => "object"],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('allocate_search');
-                $result = $searchServer->createBase('dev_allocate_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'dev_allocate_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //调拨删除
-            case 22:
-                $searchServer = Factory::search('allocate_search');
-                $searchServer->setIndex('dev_allocate_search');
-                $a = $searchServer->deleteBase('dev_allocate_search');
-                print_r($a);
-                break;
-            //盘点
-            case 23:
-                $mappings = array(
-                    'mappings' => array(
-                        "stocktaking" => [
-                            "properties" => [
-                                'id'              => ["type" => "integer"],
-                                'no'              => ["type" => "keyword"],
-                                'warehouseId'     => ['type' => 'integer'],
-                                'operatorId'      => ['type' => 'integer'],
-                                'operatorName'    => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'auditId'         => ['type' => 'integer'],
-                                'auditName'       => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'remark'          => ['type' => 'text'],
-                                'deleteStatus'    => ['type' => 'integer'],
-                                'stocktakingTime' => ['type' => 'integer'],
-                                'saleOutTime'     => ['type' => 'integer'],
-                                'createTime'      => ['type' => 'integer'],
-                                'updateTime'      => ['type' => 'integer'],
-                                'auditStatus'     => ["type" => "integer"],
-                                'auditTime'       => ["type" => "integer"],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('stocktaking_search');
-                $result = $searchServer->createBase('dev_stocktaking_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'dev_stocktaking_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //盘点删除
-            case 24:
-                $searchServer = Factory::search('stocktaking_search');
-                $searchServer->setIndex('dev_stocktaking_search');
-                $a = $searchServer->deleteBase('dev_stocktaking_search');
-                print_r($a);
-                break;
-            //库存流水
-            case 25:
-                $mappings = array(
-                    'mappings' => array(
-                        "inventory_details" => [
-                            "properties" => [
-                                'id'                 => ["type" => "integer"],
-                                'sourceNo'           => ["type" => "keyword"],
-                                'warehouseId'        => ['type' => 'integer'],
-                                'materielId'         => ['type' => 'integer'],
-                                'materielName'       => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'operatorId'         => ['type' => 'integer'],
-                                'operatorName'       => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'inventoryNum'       => ['type' => 'double'],
-                                'inventoryChangeNum' => ['type' => 'double'],
-                                'skuId'              => ['type' => 'integer'],
-                                'source'             => ['type' => 'integer'],
-                                'batch'              => ['type' => 'object'],
-                                'costType'           => ['type' => 'integer'],
-                                'averageCost'        => ['type' => 'double'],
-                                'batchCost'          => ['type' => 'double'],
-                                'actionType'         => ["type" => "integer"],
-                                'createTime'         => ['type' => 'integer'],
-                                'updateTime'         => ['type' => 'integer'],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('inventory_details_search');
-                $result = $searchServer->createBase('online_inventory_details_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_inventory_details_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //库存流水删除
-            case 26:
-                $searchServer = Factory::search('inventory_details_search');
-                $searchServer->setIndex('online_inventory_details_search');
-                $a = $searchServer->deleteBase('online_inventory_details_search');
-                print_r($a);
-                break;
-            //客户调价单
-            case 27:
-                $mappings = array(
-                    'mappings' => array(
-                        "customerPriceAdjustmentSheet" => [
-                            "properties" => [
-                                /*订单表信息*/
-                                'enterpriseId'      => ['type' => 'integer'],//enterpriseId,
-                                'id'                => ["type" => "integer"],//自增id,
-                                'no'                => ["type" => "keyword"],//调价单号,
-                                'goodsCode'         => ['type' => 'keyword'],//商品编号
-                                'goodsName'         => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//商品名称
-                                'goodsId'           => ['type' => 'integer'],//商品id
-                                'shopId'            => ['type' => 'integer'],//店铺id
-                                'shopName'          => ['type' => 'keyword'],//店铺名称
-                                'createUserId'      => ['type' => 'integer'],//创建人id
-                                'createUserName'    => ['type' => 'keyword'],//创建人姓名
-                                'effectiveUserName' => ['type' => 'keyword'],//生效人姓名
-                                'effectiveUserId'   => ['type' => 'integer'],//生效人id
-                                'deleteStatus'      => ['type' => 'integer'],//删除状态 4删除 5正常
-                                'effectiveStatus'   => ['type' => 'integer'],//生效状态 1.待审 2审核通过 3未通过 4审核中
-                                'createTime'        => ['type' => 'integer'],//创建时间
-                                'updateTime'        => ['type' => 'integer'],//修改时间
-                                'customerId'        => ['type' => 'integer'],//客户id
-                                'customerName'      => ['type' => 'keyword'],//客户名称
-                                'customerCode'      => ['type' => 'keyword'],//客户编码
-                                'salePrice'         => [
-                                    "properties" => [
-
-                                    ]
-                                ],//销售价格
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('customerPriceAdjustmentSheet_search');
-                $result = $searchServer->createBase('online_customer_price_adjustment_sheet_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_customer_price_adjustment_sheet_search init done.';
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //客户调价单删除
-            case 28:
-                $searchServer = Factory::search('customerPriceAdjustmentSheet_search');
-                $searchServer->setIndex('online_customer_price_adjustment_sheet_search');
-                $a = $searchServer->deleteBase('dev_customer_price_adjustment_sheet_search');
-                print_r($a);
-                break;
-            //销售退货
-            case 29:
-                $mappings = array(
-                    'mappings' => array(
-                        "order_out" => [
-                            "properties" => [
-                                'id'            => ["type" => "integer"],
-                                'no'            => ["type" => "keyword"],
-                                'sourceId'      => ["type" => "integer"],
-                                'sourceNo'      => ["type" => "keyword"],
-                                'shopId'        => ['type' => 'integer'],
-                                'operatorId'    => ['type' => 'integer'],
-                                'operatorName'  => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'auditId'       => ['type' => 'integer'],
-                                'auditName'     => ['type' => 'text'],
-                                'remark'        => ['type' => 'text'],
-                                'auditTime'     => ['type' => 'integer'],
-                                'auditStatus'   => ['type' => 'integer'],
-                                'deleteStatus'  => ['type' => 'integer'],
-                                'linkId'        => ['type' => 'integer'],
-                                'goodsId'       => ['type' => 'integer'],
-                                'goodsName'     => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'goodsCode'     => ['type' => 'text'],
-                                'goodsBasicId'  => ['type' => 'integer'],
-                                'skuId'         => ['type' => 'integer'],
-                                'num'           => ['type' => 'double'],
-                                'costUnitPrice' => ['type' => 'double'],
-                                'createTime'    => ['type' => 'integer'],
-                                'updateTime'    => ['type' => 'integer'],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('order_out_search');
-                $result = $searchServer->createBase('online_order_out_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_order_out_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //销售退货删除
-            case 30:
-                $searchServer = Factory::search('order_out_search');
-                $searchServer->setIndex('online_order_out_search');
-                $a = $searchServer->deleteBase('online_order_out_search');
-                print_r($a);
-                break;
-            //采购明细
-            case 31:
-                $mappings = array(
-                    'mappings' => array(
-                        "purchase_details" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],
-                                'no'           => ["type" => "keyword"],
-                                'shopId'       => ["type" => "integer"],
-                                'shopName'     => ["type" => "text", "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'supplierId'   => ['type' => 'integer'],
-                                'supplierName' => ['type' => 'text'],
-                                'buyerId'      => ['type' => 'integer'],
-                                'buyerName'    => ['type' => 'text'],
-                                'remark'       => ['type' => 'text'],
-                                'operatorId'   => ['type' => 'integer'],
-                                'operatorName' => ['type' => 'text'],
-                                'auditId'      => ['type' => 'integer'],
-                                'auditName'    => ['type' => 'text'],
-                                'auditTime'    => ['type' => 'integer'],
-                                'auditStatus'  => ['type' => 'integer'],
-                                'deleteStatus' => ['type' => 'integer'],
-                                'createTime'   => ['type' => 'integer'],
-                                'updateTime'   => ['type' => 'integer'],
-
-                                'linkId'         => ['type' => 'integer'],
-                                'goodsId'        => ['type' => 'integer'],
-                                'goodsName'      => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'basicGoodsId'   => ['type' => 'integer'],
-                                'skuId'          => ['type' => 'integer'],
-                                'categoryId'     => ['type' => 'integer'],
-                                'categoryName'   => ['type' => 'text'],
-                                'buyerNum'       => ['type' => 'double'],
-                                'buyerUnitPrice' => ['type' => 'double'],
-                                'subtotalPrice'  => ['type' => 'double'],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('purchase_details_search');
-                $result = $searchServer->createBase('online_purchase_details_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_purchase_details_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //采购明细删除
-            case 32:
-                $searchServer = Factory::search('purchase_details_search');
-                $searchServer->setIndex('online_purchase_details_search');
-                $a = $searchServer->deleteBase('online_purchase_details_search');
-                print_r($a);
-                break;
-            //优惠券
-            case 33:
-                $mappings = array(
-                    'mappings' => array(
-                        "coupon" => [
-                            "properties" => [
-                                /*优惠券信息*/
-                                'enterpriseId'     => ['type' => 'integer'],//enterpriseId,
-                                'id'               => ["type" => "integer"],//自增id,
-                                'startTime'        => ["type" => "keyword"],//优惠券生效开始时间
-                                'endTime'          => ['type' => 'keyword'],//结束时间
-                                'name'             => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//优惠券名称
-                                'couponType'       => ['type' => 'integer'],//优惠券类型
-                                'reducePrice'      => ['type' => 'scaled_float', 'scaling_factor' => 100],//满减券-减免金额(面值)
-                                'minPrice'         => ['type' => 'scaled_float', 'scaling_factor' => 100],//最低消费金额 0.00不限金额
-                                'remark'           => ['type' => 'text'],//使用说明
-                                'grantType'        => ['type' => 'integer'],//发放方式(10主动领取 20定向发放 30注册领取 40在线支付赠送)
-                                'totalNum'         => ['type' => 'integer'],//发放总数量(-1为不限制)
-                                'allowNum'         => ['type' => 'integer'],//每人限制领取数量(-1为不限制)
-                                'customerSourceId' => ['type' => 'text'],//领取范围
-                                'mustCondition'    => ['type' => 'scaled_float', 'scaling_factor' => 100],//(40在线支付赠送)-满X金额发放 0.00所有在线支付不限金额可领取这个优惠券
-                                'grantStartTime'   => ['type' => 'integer'],//发放开始时间
-                                'grantEndTime'     => ['type' => 'integer'],//发放结束时间
-                                'useShop'          => ['type' => 'text'],//使用范围
-                                'applyRange'       => ['type' => 'integer'],//商品适用范围
-                                'categoryCollect'  => ['type' => 'text'],//分类集合
-                                'brandCollect'     => ['type' => 'text'],//品牌集合
-                                'receiveNum'       => ['type' => 'integer'],//已领取数量
-                                'deleteStatus'     => ['type' => 'integer'],//删除状态
-                                'auditStatus'      => ['type' => 'integer'],
-                                'createTime'       => ['type' => 'integer'],
-                                'updateTime'       => ['type' => 'integer'],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('coupon_search');
-                $result = $searchServer->createBase('dev_coupon_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'dev_coupon_search init done.';
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除优惠券
-            case 34:
-                $searchServer = Factory::search('coupon_search');
-                $searchServer->setIndex('dev_coupon_search');
-                $a = $searchServer->deleteBase('dev_coupon_search');
-                print_r($a);
-                break;
-            //优惠券记录
-            case 35:
-                $mappings = array(
-                    'mappings' => array(
-                        "user_coupon" => [
-                            "properties" => [
-                                /*优惠券信息*/
-                                'enterpriseId'    => ['type' => 'integer'],//enterpriseId,
-                                'id'              => ["type" => "integer"],//自增id,
-                                'couponId'        => ["type" => "integer"],//优惠券id
-                                'name'            => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//优惠券名称
-                                'remark'          => ['type' => 'text'],//使用说明
-                                'couponType'      => ['type' => 'integer'],//优惠券类型
-                                'reducePrice'     => ['type' => 'scaled_float', 'scaling_factor' => 100],//满减券-减免金额(面值)
-                                'minPrice'        => ['type' => 'scaled_float', 'scaling_factor' => 100],//最低消费金额 0.00不限金额
-                                'startTime'       => ["type" => "keyword"],//优惠券生效开始时间,
-                                'endTime'         => ['type' => 'keyword'],//结束时间
-                                'applyRange'      => ['type' => 'integer'],//商品适用范围
-                                'categoryCollect' => ['type' => 'text'],//分类集合
-                                'brandCollect'    => ['type' => 'text'],//品牌集合
-                                'isExpire'        => ['type' => 'integer'],//是否过期 4未过期 5已过期
-                                'isUse'           => ['type' => 'integer'],//是否使用 4未过期 5已过期
-                                'useTime'         => ['type' => 'integer'],//使用时间
-                                'userId'          => ['type' => 'integer'],//用户id
-                                'customerId'      => ['type' => 'integer'],//客户id
-                                'shopId'          => ['type' => 'integer'],//店铺id
-                                'useShop'         => ['type' => 'text'],//使用范围
-                                'source'          => ['type' => 'integer'],//优惠券来源(10主动领取 20定向发放 30注册领取 40在线支付赠送)
-                                'createTime'      => ['type' => 'integer'],//创建时间
-                                'updateTime'      => ['type' => 'integer'],//更新时间
-                                'orderNo'         => ['type' => 'text'],//使用单号
-                                'orderId'         => ['type' => 'integer'],//订单id
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('user_coupon_search');
-                $result = $searchServer->createBase('online_user_coupon_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_user_coupon_search init done.';
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除优惠券记录
-            case 36:
-                $searchServer = Factory::search('user_coupon_search');
-                $searchServer->setIndex('online_user_coupon_search');
-                $a = $searchServer->deleteBase('online_user_coupon_search');
-                print_r($a);
-                break;
-            //促销活动
-            case 37:
-                $mappings = array(
-                    'mappings' => array(
-                        "activity" => [
-                            "properties" => [
-                                /*促销活动信息*/
-                                'enterpriseId'     => ['type' => 'integer'],//enterpriseId,
-                                'id'               => ["type" => "integer"],//自增id,
-                                'activityType'     => ["type" => "integer"],//活动类型
-                                'title'            => ['type' => 'text', "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],//名称
-                                'remark'           => ['type' => 'text'],//客户沟通
-                                'startTime'        => ["type" => "integer"],//活动开始时间,
-                                'endTime'          => ['type' => 'integer'],//活动结束时间
-                                'enableStatus'     => ["type" => "integer"],
-                                'images'           => ["type" => "text"],//活动图
-                                'useShop'          => ['type' => 'text'],//使用范围
-                                'customerRange'    => ['type' => 'integer'],//客户范围
-                                'customerSourceId' => ['type' => 'text'],//客户id 1,2
-                                'sort'             => ['type' => 'integer'],
-                                'describe'         => ['type' => 'text'],
-                                'createTime'       => ['type' => 'integer'],
-                                'updateTime'       => ['type' => 'integer'],
-                                'isEnd'            => ['type' => 'integer'],
-                                'deleteStatus'     => ['type' => 'integer'],
-                                'auditStatus'      => ['type' => 'integer'],
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('activity_search');
-                $result = $searchServer->createBase('online_activity_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_activity_search init done.';
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-
-            //促销活动删除
-            case 38:
-                $searchServer = Factory::search('activity_search');
-                $searchServer->setIndex('online_activity_search');
-                $a = $searchServer->deleteBase('online_activity_search');
-                print_r($a);
-                break;
-            //批次
-            case 39:
-                $mappings = array(
-                    'mappings' => array(
-                        "inventory_batch" => [
-                            "properties" => [
-                                'id' => ["type" => "integer"],
-                                'enterpriseId' => ['type' => 'integer'],
-                                'warehouseId' => ["type" => "integer"],
-                                'batchNo' => ["type" => "keyword"],
-                                'originId' => ["type" => "integer"],
-                                'originNo' => ["type" => "keyword"],
-                                'sourceNo' => ["type" => "keyword"],
-                                'materielId' => ["type" => "integer"],
-                                'materielCode' => ["type" => "keyword"],
-                                'materielName' => ["type" => "text", "analyzer" => "ik_max_word", "search_analyzer" => "ik_max_word"],
-                                'skuId' => ["type" => "integer"],
-                                'num' => ['type' => 'double'],
-                                'averageCost' => ['type' => 'double'],
-                                'batchCost' => ['type' => 'double'],
-                                'productionData' => ["type" => "integer"],
-                                'batchStatus' => ["type" => "integer"],
-                                'createTime' => ["type" => "integer"],
-                                'updateTime' => ["type" => "integer"],
-                            ]
-                        ]
-                    )
-                );
-                $searchServer = Factory::search('inventory_batch_search');
-                $result = $searchServer->createBase('online_inventory_batch_search', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'online_inventory_batch_search init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //批次删除
-            case 40:
-                $searchServer = Factory::search('inventory_batch_search');
-                $searchServer->setIndex('online_inventory_batch_search');
-                $a = $searchServer->deleteBase('online_inventory_batch_search');
-                print_r($a);
-                break;
-            //添加登录日志索引库
-            case 41:
-                //创建映射
-                $mappings = array(
-                    'mappings' => array(
-                        "_default_" => [
-                            "properties" => [
-                                'id'           => ["type" => "integer"],
-                                'name'       => ['type' => 'keyword'],//联系电话
-                            ]
-                        ]
-                    )
-                );
-
-                $searchServer = Factory::search('test');
-                $result = $searchServer->createBase('test', $mappings);
-                if ($result && !isset($result['error'])) {
-                    echo 'test init done.';
-                    return true;
-                } else {
-                    print_r($result['error']);
-                    return false;
-                }
-                break;
-            //删除登录日志
-            case 42:
-                $searchServer = Factory::search('test');
-                $searchServer->setIndex('test');
-                $a = $searchServer->deleteBase('test');
-                print_r($a);
-                break;
-        }
-    }
-
-    public function initSearch()
-    {
-        $num = $this->request->param('request_id');
-        //$search = [2,4,6,8,10,12];
-        //$search = [1,3,5,7,9,11];
-        $search = [$num];
-        foreach ($search as $s) {
-            $this->search($s);
-        }
-
-    }
-
-}

+ 0 - 297
Controller/Common/EasyTest.Class.php

@@ -1,297 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Common;
-
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Dao\Order\DOrder;
-use JinDouYun\Dao\Order\DOrderGoods;
-use JinDouYun\Dao\Order\DOrderReceive;
-use JinDouYun\Dao\System\DReceiptTemplate;
-use JinDouYun\Model\Order\MOrderReturn;
-use JinDouYun\Model\Shop\MShop;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-
-class EasyTest extends BaseController
-{
-
-    public function __construct()
-    {
-        parent::__construct(false, false, false, true);
-    }
-
-    public function testSub()
-    {
-        print_r($this->areaCode);die;
-        $objMOrderReturn = new MOrderReturn(64,4);
-        $result = $objMOrderReturn->getSubRetMoneyToday();
-        if (!$result->isSuccess()){
-            parent::sendOutput($result->getData(),$result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * Doc: (des="编辑销售单模版")
-     * User: XMing
-     * Date: 2020/11/26
-     * Time: 11:22 上午
-     */
-    public function orderReceipt()
-    {
-        $params = $this->request->getRawJson();
-
-        if (!isset($params['type']) || empty($params['type'])){
-            echo 'type参数错误' . PHP_EOL;
-            die;
-        }
-        $type = $params['type'];
-        if (!isset($params['key']) || empty($params['key'])) {
-            echo 'key参数错误' . PHP_EOL;
-            die;
-        }
-        $key = $params['key'];
-        if (!isset($params['action']) || empty($params['action'])) {
-            echo 'action参数错误' . PHP_EOL;
-            die;
-        }
-        $action = $params['action'];
-        if (!isset($params['row']) || empty($params['row'])) {
-            echo 'row参数错误' . PHP_EOL;
-            die;
-        }
-        $group = $params['row'];
-
-        $alias = isset($group['alias']) ? $group['alias'] : '';
-        $objDReceiptTemplate = new DReceiptTemplate();
-        $lists = $objDReceiptTemplate->select(['receiptType' => $type]);
-        if ($lists === false) {
-            echo 'sql:' . $objDReceiptTemplate->error() . PHP_EOL;
-            die;
-        }
-        $i = 0;
-        foreach ($lists as $list) {
-            $fieldsData = json_decode($list['fieldsData'], true);
-            if (!isset($fieldsData['templateInfo'][$key])) {
-                echo $list['enterpriseId'] . '数据配置错误' . PHP_EOL;
-                die;
-            }
-            $id = $list['id'];
-            $rows = $fieldsData['templateInfo'][$key];
-            switch ($action) {
-                case 'add':
-                    $hasAlias = [];
-                    foreach ($rows as $index => $row) {
-                        $hasAlias[] = $row['alias'];
-                    }
-                    if (!in_array($alias, $hasAlias)) {
-                        $rows[] = $group;
-                    }
-                    break;
-                case 'del':
-                    foreach ($rows as $index => $row) {
-                        if ($row['alias'] == $alias) {
-                            unset($rows[$index]);
-                        }
-                    }
-                    break;
-            }
-
-            $fieldsData['templateInfo'][$key] = array_values($rows);
-            $nowFieldsData = json_encode($fieldsData);
-            $update = $objDReceiptTemplate->update(['fieldsData' => $nowFieldsData], $id);
-            if ($update === false) {
-                echo 'sql-update-error:' . $objDReceiptTemplate->error() . PHP_EOL;
-            }
-            $i++;
-        }
-        echo '共计更新' . $i . '条数据';
-    }
-
-
-    public function test()
-    {
-        $objDReceiptTemplate = new DReceiptTemplate();
-        $lists = $objDReceiptTemplate->select(['receiptType' => 5]);
-        if ($lists === false) {
-            echo 'sql:' . $objDReceiptTemplate->error() . PHP_EOL;
-            die;
-        }
-
-        foreach ($lists as $list) {
-            $id = $list['id'];
-            $fieldsData = json_decode($list['fieldsData'], true);
-            if (empty($fieldsData)) {
-                continue;
-            }
-            $insertBasic = [
-                [
-                    "alias"  => "operatorName",
-                    "fields" => "制单人",
-                    "isShow" => 4
-                ],
-                [
-                    "alias"  => "receivedName",
-                    "fields" => "收货人",
-                    "isShow" => 4
-                ]
-            ];
-            /*$insertFiance = [
-                [
-                    "alias"  => "orderPreferential",
-                    "fields" => "优惠",
-                    "isShow" => 4
-                ]
-            ];*/
-            $insertOther = [
-                [
-                    "alias"  => "receivedMobile",
-                    "fields" => "收货电话",
-                    "isShow" => 4
-                ],
-            ];
-            $fieldsData['templateInfo']['basic'] = array_merge($fieldsData['templateInfo']['basic'], $insertBasic);
-            //$fieldsData['templateInfo']['fiance'] = array_merge($fieldsData['templateInfo']['fiance'],$insertFiance);
-            $fieldsData['templateInfo']['other'] = array_merge($fieldsData['templateInfo']['other'], $insertOther);
-            $nowFieldsData = json_encode($fieldsData);
-            $update = $objDReceiptTemplate->update(['fieldsData' => $nowFieldsData], $id);
-            if ($update === false) {
-                echo 'sql-update-error:' . $objDReceiptTemplate->error() . PHP_EOL;
-            }
-        }
-        echo '共计更新' . count($lists) . '条数据';
-    }
-
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/11/18
-     * Time: 3:47 下午
-     * @throws \Exception
-     */
-    public function syncOrderEs()
-    {
-        $enterId = 4;
-        $objDOrder = new DOrder();
-        $objDOrder->setSearchIndex('order_search')->setType('order');
-        $objDOrderGoods = new DOrderGoods();
-        $objDOrderReceive = new DOrderReceive();
-        $objDOrder->setTable('qianniao_order_' . $enterId . '_1');
-        $objDOrderGoods->setTable('qianniao_order_goods_' . $enterId . '_1');
-        $objDOrderReceive->setTable('qianniao_order_receive_' . $enterId . '_1');
-        $orderLists = $objDOrder->select();
-        if ($orderLists === false) {
-            echo 'sql-error: ' . $objDOrder->error() . PHP_EOL;
-            die;
-        }
-        $orderGoodsLists = $objDOrderGoods->select();
-        if ($orderGoodsLists === false) {
-            echo 'sql-error: ' . $objDOrderGoods->error() . PHP_EOL;
-            die;
-        }
-        $orderReceiveLists = $objDOrderReceive->select();
-        if ($orderReceiveLists === false) {
-            echo 'sql-error: ' . $objDOrderReceive->error() . PHP_EOL;
-            die;
-        }
-        $mapGoods = [];
-        $mapGoodsNames = [];
-        foreach ($orderGoodsLists as $orderGoods) {
-            $mapGoods[$orderGoods['orderId']][] = $orderGoods;
-            !isset($mapGoodsNames[$orderGoods['orderId']]) && $mapGoodsNames[$orderGoods['orderId']] = '';
-            $mapGoodsNames[$orderGoods['orderId']] .= $orderGoods['goodsName'] . ' ';
-        }
-        unset($orderGoodsLists);
-        $mapReceive = [];
-        foreach ($orderReceiveLists as $orderReceive) {
-            $mapReceive[$orderReceive['orderId']] = $orderReceive;
-        }
-        unset($orderReceiveLists);
-
-        $i = 0;
-        foreach ($orderLists as $list) {
-            $_id = self::createEsDocumentId($list['id'], $enterId);
-            $list['goodsName'] = isset($mapGoodsNames[$list['id']]) ? $mapGoodsNames[$list['id']] : '';
-            $buildData = self::buildData($list, $enterId, isset($mapReceive[$list['id']]) ? $mapReceive[$list['id']] : []);
-
-            $result = $objDOrder->addUpSearchIndexDocument($buildData, $_id);
-            if (isset($result['_shards']) && isset($result['_shards']['successful']) && $result['_shards']['successful'] == 1) {
-                //echo "es操作成功";
-                //return;
-                echo ' ' . $_id . ' ';
-                $i++;
-            } else {
-                echo "es操作失败" . PHP_EOL;
-            }
-        }
-
-        echo '共写入' . $i . '条数据' . PHP_EOL;
-    }
-
-    public static function buildData($params, $enterId, $addressData)
-    {
-        return [
-            'id'                => isset($params['id']) ? $params['id'] : 0,//订单编号,
-            'no'                => isset($params['no']) ? $params['no'] : '',//订单编号,
-            'outerTradeNo'      => '',//'外部流水号(支付宝/微信返回的流水号)'
-            'shopId'            => isset($params['shopId']) ? $params['shopId'] : 0,
-            'shopName'          => isset($params['shopName']) ? $params['shopName'] : '',
-            'enterpriseId'      => $enterId,
-            'userCenterId'      => isset($params['userCenterId']) ? $params['userCenterId'] : 0,
-            'totalMoney'        => isset($params['totalMoney']) ? $params['totalMoney'] : 0,
-            'payAmount'         => isset($params['payAmount']) ? $params['payAmount'] : 0,
-            'buyTotal'          => isset($params['buyTotal']) ? $params['buyTotal'] : 0,
-            'customerName'      => isset($params['customerName']) ? $params['customerName'] : '',//客户姓名
-            'customerId'        => isset($params['customerId']) ? $params['customerId'] : 0,//客户id
-            'customerType'      => isset($params['customerType']) ? $params['customerType'] : 0,//客户类型
-            'payStatus'         => isset($params['payStatus']) ? $params['payStatus'] : 0,//'支付状态  默认4 未支付 5已支付'
-            'orderStatus'       => isset($params['orderStatus']) ? $params['orderStatus'] : StatusCode::$orderStatus['waitPay'],//订单状态 默认1 创建 2待支付 3代发货 4待收货 5已完成 6已关闭
-            'payType'           => isset($params['payType']) ? $params['payType'] : 0,//'支付方式 1微信 2支付宝 3货到付款 4上门自提'
-            'deliveryType'      => isset($params['deliveryType']) ? $params['deliveryType'] : 0,//'配送方式 1商品配送 2上门自提'
-            'source'            => isset($params['source']) ? $params['source'] : 1,//订单来源 默认1 ios 2android 3小程序 4后台创建
-            'remark'            => isset($params['remark']) ? $params['remark'] : '',//订单备注
-            'auditStatus'       => isset($params['auditStatus']) ? $params['auditStatus'] : 1,// '审核状态 默认1 待审 2审核通过 3 审核未通过 4 审核中'
-            //'payTime'      => '',//'付款时间'
-            'createTime'        => isset($params['createTime']) ? $params['createTime'] : 0,//'创建时间'
-            'updateTime'        => isset($params['updateTime']) ? $params['updateTime'] : 0,//'修改时间',
-            'salesManId'        => isset($params['salesManId']) ? $params['salesManId'] : 0,
-            'salesManName'      => isset($params['salesManName']) ? $params['salesManName'] : '',
-            'returnStatus'      => isset($params['notReturn']) ? $params['notReturn'] : StatusCode::$orderReturn['notReturn'],
-            'outStatus'         => isset($params['outStatus']) ? $params['outStatus'] : StatusCode::$delete,
-            'verifyCode'        => isset($params['verifyCode']) ? $params['verifyCode'] : '',//核销码
-
-            /*收货人信息*/
-            'realName'          => isset($addressData['realName']) ? $addressData['realName'] : '',//收货人姓名
-            'mobile'            => isset($addressData['mobile']) ? $addressData['mobile'] : '',//收货人电话
-            'address'           => isset($addressData['address']) ? $addressData['address'] : '',//收货详细地址
-            'provinceCode'      => isset($addressData['provinceCode']) ? $addressData['provinceCode'] : '',//收货人省份编码
-            'cityCode'          => isset($addressData['cityCode']) ? $addressData['cityCode'] : '',//收货人城市编码
-            'districtCode'      => isset($addressData['districtCode']) ? $addressData['districtCode'] : '',//收货人区编码
-
-            /*优惠信息*/
-            'preferential'      => isset($params['preferential']) ? $params['preferential'] : 0,//优惠券优惠金额
-            'vipDiscount'       => isset($params['vipDiscount']) ? $params['vipDiscount'] : 0,//会员卡优惠金额
-            'vipDoubleDiscount' => isset($params['vipDoubleDiscount']) ? $params['vipDoubleDiscount'] : 0,//会员卡折上折优惠金额
-
-            /*商品信息*/
-            'goodsName'         => $params['goodsName'] ? $params['goodsName'] : '',
-            'orderType'         => isset($params['orderType']) ? $params['orderType'] : StatusCode::$orderType['salesSlip'],
-        ];
-    }
-
-    /**
-     * 创建文档id
-     *
-     * @param $orderId
-     * @param $onlineEnterpriseId
-     * @return string
-     */
-    private function createEsDocumentId($orderId, $onlineEnterpriseId)
-    {
-        return 'EnterpriseId_' . $onlineEnterpriseId . '_OrderId_' . intval($orderId);
-    }
-
-}

+ 0 - 42
Controller/Common/EnterpriseCategory.Class.php

@@ -1,42 +0,0 @@
-<?php
-/**
- * 企业类型
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/25
- * Time: 11:51
- */
-namespace Jindouyun\Controller\Common;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Factory;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Enterprise\MEnterpriseCategory;
-
-
-class EnterpriseCategory extends BaseController
-{
-    private $objMEnterpriseCategory;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMEnterpriseCategory = new MEnterpriseCategory();
-    }
-
-    /**
-     * 获取所有企业类型
-     */
-    public function getAllEnterpriseCategory()
-    {
-        $result = $this->objMEnterpriseCategory->getAllEnterpriseCategory();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-}

+ 0 - 35
Controller/Common/FormatGoodsBasic.Class.php

@@ -1,35 +0,0 @@
-<?php
-/**
- * 处理商品信息文件
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/05/28
- * Time: 11:31
- */
-namespace Jindouyun\Controller\Common;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\GoodsCategory\MGoodsCategory;
-use JinDouYun\Model\GoodsManage\MGoodsBasic;
-
-
-class FormatGoodsBasic
-{
-    /**
-     * 处理文件
-     * @throws Exception
-     */
-    public function formatGoodsBasicData()
-    {
-        $objMGoodsBasic = new MGoodsBasic(380,24);
-
-    }
-}

+ 0 - 79
Controller/Common/Logger.Class.php

@@ -1,79 +0,0 @@
-<?php
-
-namespace JinDouYun\Controller\Common;
-error_reporting(0);
-/**
- * demo Logger::php_error_log(E_USER_ERROR,'查询企业列表失败',__CLASS__,__LINE__,$objDEnterprise->error());
- * 错误记录
- * Class Logger
- * @package JinDouYun\Controller\Common
- */
-class Logger
-{
-    /**
-     * @var string 外部php生成日志路基
-     */
-    private static $customFileLogDir = '/www/wwwroot/logs/';
-
-    /**
-     * 写入php错误日志
-     *
-     * @param string $errno 错误编号
-     * @param string $errmsg 错误信息
-     * @param string $filename 错误文件 __CLASS__
-     * @param string $linenum 错误行数 __LINE__
-     * @param mixed $vars 错误参数
-     * @param boolean|string $custom 使用非容器内php时这个参数传true
-     *
-     */
-    public static function logs($errno, $errmsg, $filename, $linenum, $vars, $custom = false)
-    {
-        if (!defined('E_STRICT')) define('E_STRICT', 2048);
-
-        $errortype = array(
-            E_ERROR           => 'Error',
-            E_WARNING         => 'Warning',
-            E_PARSE           => 'Parsing Error',
-            E_NOTICE          => 'Notice',
-            E_CORE_ERROR      => 'Core Error',
-            E_CORE_WARNING    => 'Core Warning',
-            E_COMPILE_ERROR   => 'Compile Error',
-            E_COMPILE_WARNING => 'Compile Warning',
-            E_USER_ERROR      => 'User Error',
-            E_USER_WARNING    => 'User Warning',
-            E_USER_NOTICE     => 'User Notice',
-            E_STRICT          => 'Runtime Notice'
-        );
-        $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
-        $filename = str_replace("\\", '/', $filename);
-        $dt = date('Y-m-d H:i:s');
-
-        $err = "#####" . $dt . "\n";
-        $err .= "```" . "\n";
-        $err .= "datetime     :" . $dt . "\n";
-        $err .= "errornum     :" . $errno . "\n";
-        $err .= "errormsg     :" . $errortype[$errno] . "\n";
-        $err .= "errortype    :" . $errmsg . "\n";
-        $err .= "scriptname   :" . $filename . "\n";
-        if (in_array($errno, $user_errors)) {
-            //$err .= "scriptname   :" . wddx_serialize_value($vars, "Variables") . "\n";
-            $err .= "scriptname   :" . serialize($vars) . "\n";
-        }
-        $err .= "scriptlinenum:" . $linenum . "\n";
-        $err .= "```\n";
-
-        if ($custom === false){
-            $logDir = LOGS_DIR . 'SysError' . DS;
-        }else{
-            $logDir = self::$customFileLogDir . 'SysError' . DS;
-        }
-
-        $logFile = $logDir . date('m-d') . '.md';
-        if (!is_dir($logDir)) {
-            @mkdir($logDir);
-        }
-
-        @error_log($err, 3, $logFile);
-        @chmod($logFile, 0777);
-    }
-}

+ 0 - 323
Controller/Common/Login.Class.php

@@ -1,323 +0,0 @@
-<?php
-/**
- * 登陆类
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/10/26
- * Time: 2:36 PM
- */
-namespace JinDouYun\Controller\Common;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-
-use JinDouYun\Controller\BaseController;
-use jinDouYun\Cache\SystemCache;
-
-use Util\WeiXin\Miniprogram;
-use Util\WeiXin\Offiaccount;
-use Util\ByteDance\Microapp;
-
-class Login extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    /**
-     * 微信小程序登陆接口
-     */
-    public function login()
-    {
-        $code = $this->request->param('code');
-        if( empty($code) ){
-            $this->sendOutput('code参数错误',ErrorCode::$paramError);
-        }
-
-        /*
-        $miniprogramConfigData = Factory::config()->getAppoint('weixin','miniprogram');
-        if(empty($miniprogramConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }*/
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        
-        if( empty($miniprogramSetting) ){
-            parent::sendOutput('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting,true);
-
-        $objMiniprogram = new Miniprogram($miniprogramSetting['appid'], $miniprogramSetting['APPscrect']);
-        $result = $objMiniprogram->jscode2session($code);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 字节跳动小程序登陆接口
-     */
-    public function microappLogin()
-    {
-        $code = $this->request->param('code');
-        if( empty($code) ){
-            $this->sendOutput('参数错误',ErrorCode::$paramError);
-        }
-
-        $miniprogramConfigData = Factory::config()->getAppoint('byteDance','microapp');
-        if(empty($miniprogramConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-
-        $objMicroapp = new Microapp($miniprogramConfigData['appid'], $miniprogramConfigData['appSecret']);
-        $result = $objMicroapp->code2session($code);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 生成字节调动小程序二维码
-     */
-    public function byteCreateQRCode()
-    {
-        $paramsData = $this->request->getRawJson();
-        $params = [
-            'path'    => isset($paramsData['path']) ? $paramsData['path'] : '',
-            'appname' => isset($paramsData['appname']) ? $paramsData['appname'] : '', // toutiao 今日头条 douyin 都应
-        ];
-
-        foreach ($params as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $miniprogramConfigData = Factory::config()->getAppoint('byteDance','microapp');
-        if(empty($miniprogramConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-
-
-        $objMicroapp = new Microapp($miniprogramConfigData['appid'], $miniprogramConfigData['appSecret']);
-        $result = $objMicroapp->token();
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        $access_token = $result->getData();
-
-        $result = $objMicroapp->createQRCode($access_token, $params['path']);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 生成微信小程序二维码
-     */
-    public function createwxaqrcode()
-    {
-        $paramsData = $this->request->getRawJson();
-        $params = [
-            'path'   => isset($paramsData['path']) ? $paramsData['path'] : '',
-            'params' => isset($paramsData['params']) ? $paramsData['params'] : 0,
-        ];
-
-        foreach ($params as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        /*
-        $miniprogramConfigData = Factory::config()->getAppoint('weixin','miniprogram');
-        if(empty($miniprogramConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }
-        $objOffiaccount = new Offiaccount($miniprogramConfigData['appid'], $miniprogramConfigData['appSecret']);*/
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        if( empty($miniprogramSetting) ){
-            parent::sendOutput('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting,true);
-
-        $objOffiaccount = new Offiaccount($miniprogramSetting['appid'], $miniprogramSetting['APPscrect']);
-        $result = $objOffiaccount->token();
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        $access_token = $result->getData();
-
-        $objMiniprogram = new Miniprogram($miniprogramSetting['appid'], $miniprogramSetting['APPscrect']);
-        $result = $objMiniprogram->getwxacodeunlimit($access_token, $params);
-        if ($result->isSuccess()) {
-            
-            $url = MP_FILE_URL.$result->getData();
-            parent::sendOutput($url);
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 获取基础access_token接口
-     */
-    public function token()
-    {
-        $offiaccountConfigData = Factory::config()->getAppoint('weixin','offiaccount');
-        if(empty($offiaccountConfigData)){
-            $this->sendOutput('公众号配置项错误',ErrorCode::$configEroor);
-        }
-
-        $objOffiaccount = new Offiaccount($offiaccountConfigData['appid'], $offiaccountConfigData['appSecret']);
-        $result = $objOffiaccount->token();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 获取网页access_token
-     */
-    public function access_token()
-    {
-        $code = $this->request->param('code');
-        if( empty($code) ){
-            $this->sendOutput('参数错误',ErrorCode::$paramError);
-        }
-
-        $offiaccountConfigData = Factory::config()->getAppoint('weixin','offiaccount');
-        if(empty($offiaccountConfigData)){
-            $this->sendOutput('公众号配置项错误',ErrorCode::$configEroor);
-        }
-
-        $objOffiaccount = new Offiaccount($offiaccountConfigData['appid'], $offiaccountConfigData['appSecret']);
-        $result = $objOffiaccount->access_token($code);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * app微信授权获取个人信息
-     */
-    public function userinfo()
-    {
-        $params = $this->request->getRawJson();
-        $params = [
-            'openid' => $params['openid'],
-            'access_token'     => $params['access_token'],
-            'source'  => getArrayItem($params, 'source', StatusCode::$source['miniProgram']),
-        ];
-
-        foreach($params as $key => $value){
-            if(empty($value) && $value !== 0){
-                $this->sendOutput($key.'参数错误', ErrorCode::$paramError );
-            }
-        }
-
-        if($params['source'] == StatusCode::$source['weiXinBrowser']){
-            $offiaccountConfigData = Factory::config()->getAppoint('weixin','offiaccount');
-            if(empty($offiaccountConfigData)){
-                $this->sendOutput('公众号配置项错误',ErrorCode::$configEroor);
-            }
-
-            $objOffiaccount = new Offiaccount($offiaccountConfigData['appid'], $offiaccountConfigData['appSecret']);
-            $result = $objOffiaccount->userinfo($params['access_token'], $params['openid']);
-        }else{
-            $objSystemCache = new SystemCache();
-            $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-            if( empty($miniprogramSetting) ){
-                parent::sendOutput('后台小程序配置项为空', ErrorCode::$configEroor);
-            }
-            $miniprogramSetting = json_decode($miniprogramSetting,true);
-            $objOffiaccount = new Offiaccount($miniprogramSetting['appid'], $miniprogramSetting['APPscrect']);
-            $result = $objOffiaccount->userinfo($params['access_token'], $params['openid']);
-        }
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        $userinfo = $result->getData();
-        parent::sendOutput($userinfo);
-    }
-
-    /**
-     * js-sdk授权接口
-     */
-    public function getJsSdkConfig()
-    {
-        $offiaccountConfigData = Factory::config()->getAppoint('weixin','offiaccount');
-        if(empty($offiaccountConfigData)){
-            $this->sendOutput('公众号配置项错误',ErrorCode::$configEroor);
-        }
-
-        $objOffiaccount = new Offiaccount($offiaccountConfigData['appid'], $offiaccountConfigData['appSecret']);
-        $result = $objOffiaccount->getJsSdkConfig();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 解密数据
-     */
-    public function decryptData()
-    {
-        $params = $this->request->getRawJson();
-        $params = [
-            'openid' => isset($params['openid']) ? $params['openid'] : '',
-            'iv'     => isset($params['iv']) ? $params['iv'] : '',
-            'encryptedData' => isset($params['encryptedData']) ? $params['encryptedData'] : '',
-        ];
-
-        foreach($params as $key => $value){
-            if(empty($value) && $value !== 0){
-                $this->sendOutput($key.'参数错误', ErrorCode::$paramError );
-            }
-        }
-
-        /*
-        $miniprogramConfigData = Factory::config()->getAppoint('weixin','miniprogram');
-        if(empty($miniprogramConfigData)){
-            $this->sendOutput('小程序配置项错误',ErrorCode::$configEroor);
-        }*/
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        if( empty($miniprogramSetting) ){
-            parent::sendOutput('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting,true);
-
-        $objMiniprogram = new Miniprogram($miniprogramSetting['appid'], $miniprogramSetting['APPscrect']);
-        $result = $objMiniprogram->decryptData($params['iv'], $params['encryptedData'], $params['openid']);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 149
Controller/Common/PauseSave.Class.php

@@ -1,149 +0,0 @@
-<?php
-/**
- * 暂存Controller
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/03/30
- * Time: 16:30
- */
-
-namespace JinDouYun\Controller\Common;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Cache\PauseSave as CachePauseSave;
-
-class PauseSave extends BaseController
-{
-    private $objCachePauseSave;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objCachePauseSave = new CachePauseSave($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-    /**
-     * 暂存添加
-     */
-    public function addPauseSave()
-    {
-        //获取数据
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('数据为空', ErrorCode::$paramError);
-        }
-        $key = isset($params['key']) ? $params['key'] : '';
-        if(empty($key)){
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $data = isset($params['data']) ? $params['data'] : [];
-        if(empty($data)){
-            parent::sendOutput('暂存数据为空', ErrorCode::$paramError);
-        }
-        //查询是否已有暂存
-        //不用覆盖的原因是覆盖返回值是0
-        $cacheResult = $this->objCachePauseSave->getCacheHash($key);
-        if($cacheResult){
-            //如果已有暂存 删除之前的暂存数据
-            $delResult = $this->objCachePauseSave->delCacheHash($key);
-            if(!$delResult){
-                parent::sendOutput('删除缓存失败', ErrorCode::$paramError);
-            }
-        }
-        //保存新的暂存
-        $saveResult = $this->objCachePauseSave->addCacheHash($key, $data);
-        if(!$saveResult){
-            parent::sendOutput('缓存失败', ErrorCode::$paramError);
-        }
-        parent::sendOutput($saveResult);
-    }
-
-    /**
-     * 暂存获取
-     */
-    public function getPauseSave()
-    {
-        $params = $this->request->getRawJson();
-        $key = isset($params['key']) ? $params['key'] : '';
-        if(empty($key)){
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $cacheResult = $this->objCachePauseSave->getCacheHash($key);
-        parent::sendOutput($cacheResult);
-    }
-
-    /**
-     * 暂存删除
-     */
-    public function delPauseSave()
-    {
-        $params = $this->request->getRawJson();
-        $key = isset($params['key']) ? $params['key'] : '';
-        if(empty($key)){
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $cacheResult = $this->objCachePauseSave->delCacheHash($key);
-        parent::sendOutput($cacheResult);
-    }
-
-
-    /**************************************************** 价格暂存 ******************************************************/
-    /**
-     * 暂存添加
-     * @throws Exception
-     */
-    public function addMoneyPauseSave()
-    {
-        //获取数据
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('数据为空', ErrorCode::$paramError);
-        }
-        $data = isset($params['data']) ? $params['data'] : [];
-        if(empty($data)){
-            parent::sendOutput('暂存数据为空', ErrorCode::$paramError);
-        }
-        $cacheData = [];
-        foreach($data as $value){
-            $cacheData[$value['skuId']] =  sprintf("%.2f",substr(sprintf("%.3f", $value['money']), 0, -2));
-        }
-
-        //保存新的暂存
-        $saveResult = $this->objCachePauseSave->addMoneyCache($cacheData);
-        if(!$saveResult){
-            parent::sendOutput('缓存失败', ErrorCode::$paramError);
-        }
-        parent::sendOutput($saveResult);
-    }
-
-    /**
-     * 暂存获取
-     */
-    public function getMoneyPauseSave()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $array = isset($params['skuIds']) ? $params['skuIds'] : [];
-        if(empty($array)){
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $returnData = [];
-        foreach($array as $skuId){
-            $cacheResult = $this->objCachePauseSave->getMoneyCache($skuId);
-            if($cacheResult){
-                $returnData[$skuId] = sprintf("%.2f",substr(sprintf("%.3f", $cacheResult), 0, -2));
-            }else{
-                $returnData[$skuId] = 0.00;
-            }
-        }
-
-        parent::sendOutput($returnData);
-    }
-
-}

+ 0 - 147
Controller/Common/Pay.Class.php

@@ -1,147 +0,0 @@
-<?php
-/**
- * 通用支付接口
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/11/28
- * Time: 3:48 PM
- */
-
-namespace JinDouYun\Controller\Common;
-
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Cache\SystemCache;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\System\MPaymentSetting;
-
-use Util\WeiXin\Pay as wxPay;
-
-class Pay extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    public function micropay()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            return ResultWrapper::fail('参数为空', ErrorCode::$paramError);
-        }
-
-        $payData = [
-            'out_trade_no' => getArrayItem($params, 'out_trade_no'),
-            'total_fee'    => getArrayItem($params, 'total_fee'),
-            'ip'           => $this->request->get_onlineip(),
-            'shopName'     => getArrayItem($params, 'shopName'),
-            'auth_code'    => getArrayItem($params, 'auth_code')
-        ];
-
-        foreach ($payData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        if (empty($miniprogramSetting)) {
-            return ResultWrapper::fail('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting, true);//获取小程序appid
-
-        //获取支付配置
-        $objMPaymentSetting = new MPaymentSetting($this->onlineUserId, $this->onlineEnterpriseId);
-        $result = $objMPaymentSetting->getPayData(StatusCode::$payType['wxPay']);
-        if (!$result->isSuccess() || empty($result->getData())) {
-            return ResultWrapper::fail('获取微信配置错误', ErrorCode::$configEroor);
-        }
-        $payment = $result->getData();
-
-        unset($result);
-        $objwxPay = new wxPay($miniprogramSetting['appid'], $payment['mchId'], $payment['apiPartnerKey']);
-        $result = $objwxPay->micropay($payData['out_trade_no'], $payData['total_fee'], $payData['ip'], $payData['shopName'], $payData['auth_code']);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        parent::sendOutput($result->getData());
-    }
-
-    public function orderquery()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            return ResultWrapper::fail('参数为空', ErrorCode::$paramError);
-        }
-
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        if (empty($miniprogramSetting)) {
-            return ResultWrapper::fail('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting, true);//获取小程序appid
-
-
-        //获取支付配置
-        $objMPaymentSetting = new MPaymentSetting($this->onlineUserId, $this->onlineEnterpriseId);
-        $result = $objMPaymentSetting->getPayData(StatusCode::$payType['wxPay']);
-        if (!$result->isSuccess() || empty($result->getData())) {
-            return ResultWrapper::fail('获取微信配置错误', ErrorCode::$configEroor);
-        }
-        $payment = $result->getData();
-
-        unset($result);
-        $objwxPay = new wxPay($miniprogramSetting['appid'], $payment['mchId'], $payment['apiPartnerKey']);
-        $result = $objwxPay->orderquery($params['out_trade_no']);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        parent::sendOutput($result->getData());
-    }
-
-    // 微信付款到个人
-    public function transfers()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            return ResultWrapper::fail('参数为空', ErrorCode::$paramError);
-        }
-
-        // 获取当前登录企业的小程序配置
-        $objSystemCache = new SystemCache();
-        $miniprogramSetting = $objSystemCache->getAppIdByEnterpriseId($this->onlineEnterpriseId);
-        if (empty($miniprogramSetting)) {
-            return ResultWrapper::fail('后台小程序配置项为空', ErrorCode::$configEroor);
-        }
-        $miniprogramSetting = json_decode($miniprogramSetting, true);//获取小程序appid
-
-        //获取支付配置
-        $objMPaymentSetting = new MPaymentSetting($this->onlineUserId, $this->onlineEnterpriseId);
-        $result = $objMPaymentSetting->getPayData(StatusCode::$payType['wxPay']);
-        if (!$result->isSuccess() || empty($result->getData())) {
-            return ResultWrapper::fail('获取微信配置错误', ErrorCode::$configEroor);
-        }
-        $payment = $result->getData();
-
-        unset($result);
-        $objwxPay = new wxPay($miniprogramSetting['appid'], $payment['mchId'], $payment['apiPartnerKey']);
-        $result = $objwxPay->transfers($params['out_trade_no'], $params['openid'], $params['amount']);
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        parent::sendOutput($result->getData());
-    }
-
-}

+ 0 - 49
Controller/Common/PrintNum.Class.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * 单据打印
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2020/4/17
- * Time: 16:59
- */
-
-namespace JinDouYun\Controller\Common;
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\System\MPrintNum;
-use Mall\Framework\Core\ErrorCode;
-
-class PrintNum extends BaseController
-{
-    private $objMPrintNum;
-
-    /**
-     * PrintNum constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMPrintNum = new MPrintNum($this->onlineEnterpriseId);
-    }
-
-    /**
-     * 增加打印次数
-     */
-    public function printIncr()
-    {
-        $params = $this->request->getRawJson();
-        $objectNo = isset($params['objectNo']) ? $params['objectNo'] : null;
-        $objectType = isset($params['objectType']) ? $params['objectType'] : null;
-        if (empty($objectNo) || empty($objectType)) {
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMPrintNum->printIncr($objectNo, $objectType);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-}

+ 0 - 69
Controller/Common/Receipt.Class.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace JinDouYun\Controller\Common;
-
-
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\System\MReceipt;
-use Mall\Framework\Core\ErrorCode;
-
-/**
- * 小票打印
- * Class Receipt
- * @package JinDouYun\Controller\Common
- */
-class Receipt extends BaseController
-{
-    /**
-     * @var MReceipt
-     */
-    private $objMReceipt;
-
-    /**
-     * Receipt constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     * @param bool $getAreaCode
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
-        $this->objMReceipt = new MReceipt($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-
-    /**
-     * 公共参数
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-        $data = [
-            'objectId' => isset($params['objectId']) ? $params['objectId'] : null,
-            'objectType' => isset($params['objectType']) ? $params['objectType'] : null
-        ];
-        foreach($data as $key => $value){
-            if(empty($value)){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError );
-            }
-        }
-        return $data;
-    }
-
-    /**
-     * 打印小票
-     * @throws \Exception
-     */
-    public function toPrint()
-    {
-        $data = self::commonFieldFilter();
-        $result = $this->objMReceipt->toPrint($data['objectId'],$data['objectType']);
-        if($result->isSuccess()){
-            parent::sendOutput('操作成功');
-        }
-        parent::sendOutput($result->getData(), $result->getErrorCode());
-    }
-}

+ 0 - 188
Controller/Common/SmsCode.Class.php

@@ -1,188 +0,0 @@
-<?php
-/**
- * 发送短信验证码类
- * Created by PhpStorm.
- * User: 小威
- * Date: 2019/11/04
- * Time: 10:40
- */
-namespace Jindouyun\Controller\Common;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Factory;
-
-use JinDouYun\Cache\SmsVerification;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\UserCenter\MUserCenterRegister;
-use JinDouYun\Model\Oem\MOem;
-
-use Util\TencentCloud\Sms;
-
-
-class SmsCode extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken=false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-    /**
-     * 发送短信验证码
-     *
-     * @return void
-     * @throws Exception
-     */
-    public function sendMobileCode()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            parent::sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $data = [
-            'mobile' => trim($params['mobile']),
-            'source' => (int)$params['source'],//标识 1:后台注册 2:后台忘记密码 3:小程序注册
-        ];
-
-        foreach ($data as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        //获取当前地址栏域名替换短信签名发送
-        $objMOem = new MOem();
-        // pc页面根据domain获取配置
-        if( in_array($data['source'],[1,2]) ){
-            $data['domain'] =  trim(getArrayItem($params, 'domain', ''));
-            if( empty($data['domain']) ){
-                parent::sendOutput( 'domain参数错误', ErrorCode::$paramError);
-            }
-            $result = $objMOem->getOemInfoByDomain($data['domain']);
-            if(!$result->isSuccess()){
-                parent::sendOutput($result->getData(), $result->getErrorCode());
-            }
-            $configData = $result -> getData();
-         } else { // 小程序通过token获取配置
-            self::getEnterpriseIdByToken();
-            $result = $objMOem->getOemInfoByenterpriseId($this->onlineEnterpriseId);
-            if(!$result->isSuccess()){
-                parent::sendOutput($result->getData(), $result->getErrorCode());
-            }
-            $configData = $result -> getData();
-        }
-
-        //验证手机号格式
-        $this->checkMobile($data['mobile']);
-        //查询手机号是否存在
-        $MUserCenterRegister = new MUserCenterRegister();
-        switch ($data['source']) {
-            case 1:
-                //后台注册
-                $resultMobileIs = $MUserCenterRegister->mobileIsRegister($data['mobile']);
-                if($resultMobileIs) {
-                    parent::sendOutput('手机号已注册');
-                }
-                break;
-            case 2:
-                //后台忘记密码
-                $resultMobileIs = $MUserCenterRegister->mobileIsRegister($data['mobile']);
-                if(!$resultMobileIs) {
-                    parent::sendOutput('手机号未注册',ErrorCode::$contentNotExists);
-                }
-                break;
-            case 3:
-                //前台注册,后台创建客户
-                parent::getEnterpriseIdByToken();
-                $resultMobileIs = $MUserCenterRegister->mobileIsRegister($data['mobile'], $this->onlineEnterpriseId);
-                if($resultMobileIs) {
-                    parent::sendOutput('手机号已注册');
-                }
-                break;
-            case 4:
-                //前台忘记密码
-                parent::getEnterpriseIdByToken();
-                $resultMobileIs = $MUserCenterRegister->mobileIsRegister($data['mobile'], $this->onlineEnterpriseId);
-                if(!$resultMobileIs) {
-                    parent::sendOutput('手机号未注册');
-                }
-                break;
-            case 5:
-                //小程序绑定
-                parent::getEnterpriseIdByToken();
-                break;
-            case 6:
-                //短信登录
-                break;
-            default:
-                break;
-        }
-
-        //验证当天发送验证码次数是否超过上限
-        $SmsVerification = new SmsVerification();
-        $SmsCount = $SmsVerification->getRegisterSmsCount($data['mobile']);
-        if($SmsCount >= 5){
-            parent::sendOutput('当天发送验证码次数已达上限', ErrorCode::$configEroor);
-        }
-        //生成短信验证码
-        $mobileCode = generate_code(6);
-
-        #调用第三方短信平台
-        /*$tencentCloudConfigData = Factory::config()->get('tencentCloud');
-        if(empty($tencentCloudConfigData)){
-            $this->sendOutput('腾讯云配置错误',ErrorCode::$configEroor);
-        }
-
-        $smsCodeKey = Factory::config()->get('sms');
-        if(empty($smsCodeKey) || !isset($smsCodeKey['registerCodeKey']) || !isset($smsCodeKey['SmsSdkAppid']) || !isset($smsCodeKey['Sign'])){
-            $this->sendOutput('短信模板获取失败', ErrorCode::$configEroor);
-        }*/
-
-
-        if(empty($configData)){
-            parent::sendOutput('查询配置信息失败', ErrorCode::$contentNotExists);
-        }
-        $tencentCloudConfigData = json_decode($configData['tencentCloud'], true);
-        if(empty($tencentCloudConfigData)){
-            parent::sendOutput('腾讯云配置项为空', ErrorCode::$contentNotExists);
-        }
-        $smsCodeKey = json_decode($configData['sms'], true);
-        if(empty($smsCodeKey)){
-            parent::sendOutput('短信配置项为空', ErrorCode::$contentNotExists);
-        }
-
-        $objSms = new Sms($tencentCloudConfigData['secretId'], $tencentCloudConfigData['secretKey'], $smsCodeKey['SmsSdkAppid'], $smsCodeKey['Sign']);
-        $result = $objSms->SendSms($smsCodeKey['registerCodeKey'], ["+86".$data['mobile']], ["$mobileCode","5"]);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        //调用redis保存发送验证码记录
-        $result = $SmsVerification->userMobileCodeCache($data['mobile'], $mobileCode);
-        if($result->isSuccess()){
-            parent::sendOutput('发送短信成功');
-        }else{
-            parent::sendOutput('', $result->getData());
-        }
-    }
-
-    public function test()
-    {
-        $tencentCloudConfigData = Factory::config()->get('tencentCloud');
-        if(empty($tencentCloudConfigData)){
-            $this->sendOutput('腾讯云配置错误',ErrorCode::$configEroor);
-        }
-        $objSms = new Sms($tencentCloudConfigData['secretId'], $tencentCloudConfigData['secretKey']);
-        $smsCodeKey = Factory::config()->get('sms');
-        if(empty($smsCodeKey) || !isset($smsCodeKey['registerCodeKey'])){
-            $this->sendOutput('短信模板获取失败', ErrorCode::$configEroor);
-        }
-        $result = $objSms->SendSms($smsCodeKey['registerCodeKey'], ["+8617600105150"], ["123456","5"]);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-}

File diff suppressed because it is too large
+ 0 - 113
Controller/Common/Sql.Class.php


+ 0 - 104
Controller/Common/SysAreaChina.Class.php

@@ -1,104 +0,0 @@
-<?php
-/**
- * 地区数据(中国)
- * Created by PhpStorm.
- * User: QianNiao-C
- * Date: 2019/10/26
- * Time: 9:57
- */
-
-namespace Jindouyun\Controller\Common;
-
-use Mall\Framework\Core\ErrorCode;
-
-use JinDouYun\Cache\SysAreaChinaCache;
-use Jindouyun\Controller\BaseController;
-use JinDouYun\Model\SysAreaChina\MSysAreaChina;
-
-
-class SysAreaChina extends BaseController
-{
-    private $objMSysAreaChina;
-    private $objSysAreaChinaCache;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMSysAreaChina = new MSysAreaChina();
-        $this->objSysAreaChinaCache = new SysAreaChinaCache('mapping');
-    }
-
-    /**
-     * 获取所有省份
-     */
-    public function getAllProvince()
-    {
-        if($this->objSysAreaChinaCache->isHaveProvinceKey()) {
-            $returnData = $this->objSysAreaChinaCache->getAllProvince();//获取缓存
-        }else{
-            $result = $this->objMSysAreaChina->getAllProvince();
-            if (!$result->isSuccess()) {
-                parent::sendOutput($result->getData(), ErrorCode::$dberror);
-            }
-            $returnData = $result->getData();
-            if(!empty($returnData)){
-                $this->objSysAreaChinaCache->cacheAllProvince($returnData);
-            }
-        }
-
-        parent::sendOutput($returnData, 0, ['pageTotal'=>count($returnData)]);
-    }
-
-    /**
-     * 根据省份id获取所有城市
-     */
-    public function getAllCityByProvinceCode()
-    {
-        $code = $this->request->param('request_id');
-        if (empty($code)) {
-            $this->sendOutput('请指定省份id', ErrorCode::$paramError);
-        }
-
-        if($this->objSysAreaChinaCache->isHaveCityKeyByProvinceCode($code)){
-            $returnData = $this->objSysAreaChinaCache->getCityByProvinceCode($code);
-        }else{
-            $result = $this->objMSysAreaChina->getAllCityByProvinceCode(['pcode' => $code]);
-            if (!$result->isSuccess()) {
-                parent::sendOutput($result->getData(), ErrorCode::$dberror);
-            }
-            $returnData = $result->getData();
-            if(!empty($returnData)){
-                $this->objSysAreaChinaCache->cacheCityByCode($returnData, $code);
-            }
-        }
-
-        parent::sendOutput($returnData, 0, ['pageTotal'=>count($returnData)]);
-    }
-
-    /**
-     * 获取指定城市下的所有区
-     */
-    public function getAllAreaByCityCode()
-    {
-        $code = $this->request->param('request_id');
-        if (empty($code)) {
-            $this->sendOutput('请指定城市id', ErrorCode::$paramError);
-        }
-
-
-        if($this->objSysAreaChinaCache->isHaveAreaKeyByCityCode($code)){
-            $returnData = $this->objSysAreaChinaCache->getAreaByCityCode($code);
-        }else{
-            $result = $this->objMSysAreaChina->getAllAreaByCityCode(['pcode' => $code]);
-            if (!$result->isSuccess()) {
-                parent::sendOutput($result->getData(), ErrorCode::$dberror);
-            }
-            $returnData = $result->getData();
-            if(!empty($returnData)){
-                $this->objSysAreaChinaCache->cacheAreaByCode($returnData, $code);
-            }
-        }
-
-        parent::sendOutput($returnData, 0, ['pageTotal'=>count($returnData)]);
-    }
-}

File diff suppressed because it is too large
+ 0 - 1436
Controller/Common/Test.Class.php


+ 0 - 62
Controller/Common/Tools.Class.php

@@ -1,62 +0,0 @@
-<?php
-/**
- * 工具类
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/03/20
- * Time: 22:38
- */
-namespace Jindouyun\Controller\Common;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-
-use JinDouYun\Cache\GoodsBasicRelevant;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Dao\GoodsManage\DSku;
-
-class Tools extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    /**
-     * 缓存重置skuId和skuName的绑定
-     */
-    public function resetCacheSkuName()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'enterpriseId' => isset($params['enterpriseId']) ? $params['enterpriseId'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value)) parent::sendOutput($key.'参数为空', ErrorCode::$paramError);
-        }
-        $enterpriseId = $data['enterpriseId'];
-        $objDSku = new DSku('default');
-        $objDSku->setTable($objDSku->get_Table().'_'.$enterpriseId);
-        $dbResult = $objDSku->select(['deleteStatus' => StatusCode::$standard]);
-        if($dbResult === false){
-            parent::sendOutput($objDSku->error(), ErrorCode::$dberror);
-        }
-
-        if(empty($dbResult)) parent::sendOutput('查询数据为空', ErrorCode::$paramError);
-
-        $objGoodsBasicRelevant = new GoodsBasicRelevant($enterpriseId);
-
-        foreach ($dbResult as $value) {
-            $cacheResult = $objGoodsBasicRelevant->cacheSkuIdRelationName($value['unitName'], $value['id']);
-            if(!$cacheResult){
-                parent::sendOutput('缓存添加失败', ErrorCode::$paramError);
-            }
-        }
-        parent::sendOutput('添加成功');
-    }
-}

+ 0 - 93
Controller/Common/Upgrade.Class.php

@@ -1,93 +0,0 @@
-<?php
-/**
- * 系统升级脚本
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2021/4/28
- * Time: 3:54 PM
- */
-
-namespace Jindouyun\Controller\Common;
-
-use Mall\Framework\Factory;
-
-use JinDouYun\Cache\AllTableNameCache;
-
-use Jindouyun\Dao\Customer\DCustomer;
-
-
-class Upgrade
-{
-    private $serviceDB = 'default';
-
-    /**
-     * 升级sql执行
-     */
-    public function updateSql()
-    {
-        $sql = "
-           ALTER TABLE `www.qianniao.vip`.`qianniao_goods_1` ADD COLUMN `showMinUnitPrice` tinyint(3) NOT NULL DEFAULT 4 COMMENT '属性最小单位价格是否展示  默认 4 不展示' AFTER `realSalesNum`;
-         ";
-
-        // 提取库名和表名
-        preg_match("/(`[\S]+`)/ius", $sql, $matches);
-        if(empty($matches)){
-            echo 'sql错误,未匹配到库名与表名'.PHP_EOL;
-            exit();
-        }
-
-        $matches = explode('`.`',$matches[0]);
-        if(empty($matches)){
-            echo 'sql错误,库名或表名错误'.PHP_EOL;
-            exit();
-        }
-
-        foreach ($matches as $k => $v){
-            $matches[$k] = str_replace('`','',$v);
-        }
-
-        $databaseName = $matches[0];
-        $tableName = $matches[1];
-
-        // 表名做处理
-        $tmptableName = explode('_', $tableName);
-        $tablePrefix = '';
-        $sqlTableNumPoint = 1; // 出现数字的点位
-        foreach ($tmptableName as $k => $v){
-            if(!is_numeric($v)){
-                $tablePrefix .= $v.'_';
-                $sqlTableNumPoint +=1;
-            }
-        }
-
-        $allTableName = AllTableNameCache::getAllTableNameByDatabaseName($databaseName);
-
-        // 开始执行sql
-        $objDCustomer = new DCustomer($this->serviceDB);
-        foreach ($allTableName as $key => $value){
-            if(strpos($value, $tablePrefix) !== false){
-
-                $execTableName = explode('_', $value);
-                $execTableNumPoint = 1; // 出现数字的点位
-                foreach ($execTableName as $k => $v){
-                    if(!is_numeric($v)){
-                        $execTableNumPoint +=1;
-                    }
-                }
-                if($execTableNumPoint != $sqlTableNumPoint){
-                    continue;
-                }
-
-                $newsql = str_replace("`{$databaseName}`.`{$tableName}`","`{$databaseName}`.`{$value}`", $sql);
-                $dbResult = $objDCustomer->query($newsql);
-                if($dbResult == false){
-                    echo $objDCustomer->error().PHP_EOL;
-                    //exit();
-                    continue;
-                }
-            }
-        }
-
-        echo "当前sql执行执行完成了".PHP_EOL;
-    }
-}

+ 0 - 129
Controller/Common/Upload.Class.php

@@ -1,129 +0,0 @@
-<?php
-/**
- * 公用图片上传类
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/10/24
- * Time: 2:06 PM
- */
-
-namespace JinDouYun\Controller\Common;
-
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ErrorCode;
-
-use JinDouYun\Controller\BaseController;
-
-use Util\QiNiu\Kodo;
-
-class Upload extends BaseController
-{
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken,false,false,false);
-    }
-
-    /**
-     * 图片base64转图片地址
-     */
-    public function base64ToPath()
-    {
-        $base64 = $this->request->param('image');
-        $upload = Factory::baseImg();
-        if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64, $result)){
-            if(!empty($result)){
-                $upload->move($base64);
-                $this->sendOutput($upload->getSaveName());
-            }
-        }else{
-            $this->sendOutput('请求图片格式错误', ErrorCode::$paramError);
-        }
-    }
-
-    /**
-     * 上传文件接口
-     */
-    public function uploadFile()
-    {
-        parent::getEnterpriseIdByToken();
-        $upload = Factory::file($_FILES['file']['tmp_name']);
-        $upload->setUploadInfo($_FILES['file']);
-        $upload->validate(['ext'=>'pem']);
-        if(!$upload->move('weixinCert/'.$this->token.'/'.$_FILES['file']['name'])){
-            parent::sendOutput($upload->getError(), ErrorCode::$notAllowAccess);
-        }
-        parent::sendOutput($upload->getSaveName());
-    }
-
-    /**
-     * 上传图片到七牛对象存储获取上传凭证
-     */
-    public function uploadToken()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $uploadData = [
-            'bucket' => $params['bucket'],
-            'key'    => $params['key'],
-        ];
-        foreach ($uploadData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $qiniuConfigData = Factory::config()->get('qiniu');
-
-        if(empty($qiniuConfigData)){
-            $this->sendOutput('七牛配置错误',ErrorCode::$configEroor);
-        }
-        $objKodo = new Kodo($qiniuConfigData['accessKey'], $qiniuConfigData['secretKey']);
-
-        $result = $objKodo->uploadToken($uploadData['bucket'], $uploadData['key']);
-
-        if($result->isSuccess()){
-            $this->sendOutput($result->getData());
-        }else{
-            $this->sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 删除上传资源
-     */
-    public function delete()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $uploadData = [
-            'bucket' => $params['bucket'],
-            'key'    => $params['key'],
-        ];
-
-        foreach ($uploadData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $qiniuConfigData = Factory::config()->get('qiniu');
-        if(empty($qiniuConfigData)){
-            $this->sendOutput('七牛配置错误',ErrorCode::$configEroor);
-        }
-        $objKodo = new Kodo($qiniuConfigData['accessKey'], $qiniuConfigData['secretKey']);
-
-        $result = $objKodo->delete($uploadData['bucket'], $uploadData['key']);
-
-        if($result->isSuccess()){
-            $this->sendOutput($result->getData());
-        }else{
-            $this->sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 38
Controller/Common/Video.Class.php

@@ -1,38 +0,0 @@
-<?php
-/**
- * 腾讯云点播类
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/10/28
- * Time: 10:29 AM
- */
-namespace HeZuoQiao\Controller\Common;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Factory;
-
-use HeZuoQiao\Controller\BaseController;
-use Util\TencentCloud\Vod;
-
-class Video extends BaseController
-{
-    /**
-     * 小程序登陆接口
-     */
-    public function getUploadSign()
-    {
-
-        $ConfigData = Factory::config()->get('tencentCloud');
-        if(empty($ConfigData)){
-            $this->sendOutput('腾讯云配置项错误',ErrorCode::$configEroor);
-        }
-
-        $objVod = new Vod($ConfigData['secretId'], $ConfigData['secretKey']);
-        $result = $objVod->getUploadSign();
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 452
Controller/Common/WeiXinOpen.Class.php

@@ -1,452 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/12/2
- * Time: 2:37 PM
- */
-
-namespace JinDouYun\Controller\Common;
-
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\ErrorCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Enterprise\MEnterprise;
-use JinDouYun\Model\System\MEnterpriseBindTemplate;
-
-use JinDouYun\Model\Oem\MOem;
-
-use Util\WeiXin\Oplatform;
-use Util\WeiXin\Miniprogram;
-
-class WeiXinOpen extends BaseController
-{
-    /**
-     * 验证票据(component_verify_ticket)缓存
-     */
-    private $component_verify_ticket = 'componentVerifyTicket';
-
-    private $location_uri = 'http://'.DOMAIN_WWW.'/#/AuthorizePage';
-
-    // 授权回调地址
-    private $redirect_uri = 'http://'.DOMAIN_WWW.'/AuthorizePage';
-
-    /**
-     * WeiXinOpen constructor.
-     * @param bool $isCheckAcl
-     * @param bool $isMustLogin
-     * @param bool $checkToken
-     */
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    /**
-     * 授权事件接受URl
-     * 官方文档地址: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_verify_ticket.html
-     */
-    public function notifyAccess()
-    {
-
-        $postStr = file_get_contents('php://input');
-        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '回调数据' . var_export($postStr, true) . PHP_EOL, FILE_APPEND);
-        if (empty($postStr)) {
-            exit('faild');
-        }
-
-        $params['timestamp'] = $this->request->param('timestamp');
-        $params['msg_signature'] = $this->request->param('msg_signature');
-        $params['nonce'] = $this->request->param('nonce');
-
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                exit('回调数据有误');
-            }
-        }
-
-        libxml_disable_entity_loader(true);
-        // 先做签名校验
-        $data = json_decode(json_encode(simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
-
-        /*
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            exit('配置错误');
-        }*/
-        $objOem = new MOem();
-        $oemData = $objOem->getOemInfoByWeiXinOpenAppId($data['AppId']);
-        if(!$oemData->isSuccess()){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取配置错误' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-        $oemData = $oemData->getData();
-        if(empty($oemData)){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取配置为空' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-        $oplatformConfigData = json_decode($oemData['weixinOpen'], true);
-        if( empty($oplatformConfigData) ){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取开放平台配置为空' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-
-
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-        $result = $objOplatform->decryptMsg($params['msg_signature'], $params['timestamp'], $params['nonce'], $data);
-        if (!$result->isSuccess()) {
-            $this->sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        $xmlContent = $result->getData();
-        $data = json_decode(json_encode(simplexml_load_string($xmlContent, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
-
-        if (!empty($data) && $data['InfoType'] == 'component_verify_ticket') {
-            Factory::cache('default')->set($this->component_verify_ticket . ':' . $oplatformConfigData['appid'], $data['ComponentVerifyTicket']);
-        }
-        if(!empty($data) && isset($data['notify_third_fasteregister'])){
-            // 修改当前企业的appid
-            $enterpriseMd5Key = md5($data['name'].$data['code'].$data['legal_persona_wechat'].$data['legal_persona_name']);
-            $objMEnterprise = new MEnterprise();
-            $modelResult = $objMEnterprise->updateEnterprise(['appid' => $data['appid']], ['weChatProgramKey' => $enterpriseMd5Key]);
-            if(!$modelResult->isSuccess()){
-                $this->sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-            }
-            $result = $objOplatform->apiQueryAuth($data['auth_code']);
-            if (!$result->isSuccess()) {
-                $this->sendOutput($result->getData(), $result->getErrorCode());
-            }
-        }
-
-        exit('success');
-    }
-
-    /**
-     * 消息与事件接收URL
-     * 官方文档地址: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_verify_ticket.html
-     */
-    public function notifyMessage()
-    {
-        $appid = $this->request->param('request_id');
-        $postStr = file_get_contents('php://input');
-        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . $appid . '回调数据' . var_export($postStr, true) . PHP_EOL, FILE_APPEND);
-        if (empty($postStr)) {
-            exit('faild');
-        }
-
-        $params['timestamp'] = $this->request->param('timestamp');
-        $params['msg_signature'] = $this->request->param('msg_signature');
-        $params['nonce'] = $this->request->param('nonce');
-
-        foreach ($params as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                exit('回调数据有误');
-            }
-        }
-
-        libxml_disable_entity_loader(true);
-        // 先做签名校验
-        $data = json_decode(json_encode(simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
-
-        /*
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            exit('配置错误');
-        }*/
-        $objOem = new MOem();
-        $oemData = $objOem->getOemInfoByWeiXinOpenAppId($data['AppId']);
-        if(!$oemData->isSuccess()){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取配置错误' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-        $oemData = $oemData->getData();
-        if(empty($oemData)){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取配置为空' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-        $oplatformConfigData = json_decode($oemData['weixinOpen'], true);
-        if( empty($oplatformConfigData) ){
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . '从oem表获取开放平台配置为空' . PHP_EOL, FILE_APPEND);
-            exit('faild');
-        }
-
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-        $result = $objOplatform->decryptMsg($params['msg_signature'], $params['timestamp'], $params['nonce'], $data);
-        if (!$result->isSuccess()) {
-            echo($result->getData());exit();
-        }
-
-        $xmlContent = $result->getData();
-        $data = json_decode(json_encode(simplexml_load_string($xmlContent, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
-        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s') . $appid . '回调数据' . var_export($data, true) . PHP_EOL, FILE_APPEND);
-
-        $objMEnterpriseBindTemplate = new MEnterpriseBindTemplate(null, null);
-
-        // 事件消息
-        if (!empty($data) && isset($data['MsgType']) && $data['MsgType'] == 'event') {
-            // 小程序审核通过事件
-            if ($data['Event'] == 'weapp_audit_success') {
-                $data['auditStatus'] = StatusCode::$wxAuditStatus['pass'];
-                $objMEnterpriseBindTemplate->updateAuditStatus($data);
-            }
-
-            // 小程序审核失败事件
-            if($data['Event'] == 'weapp_audit_fail'){
-                $data['reason'] = [
-                    'reason' => isset($data['Reason']) ? $data['Reason'] : '',
-                ];
-                $data['auditStatus'] = StatusCode::$wxAuditStatus['refuse'];
-                $objMEnterpriseBindTemplate->updateAuditStatus($data);
-            }
-            exit('success');
-        }
-
-        // 注册审核时间
-        if (!empty($data) && isset($data['InfoType']) && $data['InfoType'] == 'notify_third_fasteregister') {
-
-        }
-
-        // 文本消息
-        if (!empty($data) && isset($data['MsgType']) && $data['MsgType'] == 'text') {
-            // 第三方平台验证用的固定回复
-            if($data['Content'] == 'TESTCOMPONENT_MSG_TYPE_TEXT'){
-                $reponseData = [
-                    'ToUserName'=>$data['FromUserName'],
-                    'FromUserName' =>$data['ToUserName'],
-                    'CreateTime'=>time(),
-                    'MsgType' => 'text',
-                    'Content' => 'TESTCOMPONENT_MSG_TYPE_TEXT_callback',
-                ];
-                $reponseData = arrayToWeiXinXml($reponseData);
-                echo $reponseData;
-
-                /*
-                $result = $objOplatform->encryptMsg($reponseData, $params['timestamp'], $params['nonce']);
-                if (!$result->isSuccess()) {
-                    echo($result->getData());exit();
-                }
-                $xmlContent = $result->getData();
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s'). '回调数据' . var_export($xmlContent, true) . PHP_EOL, FILE_APPEND);
-                */
-            }
-
-            // 第三方平台用的验证客服消息
-            if(strpos($data['Content'],'QUERY_AUTH_CODE') !== false){
-                $postContent = explode(':', $data['Content']);
-                $query_auth_code = $postContent[1];
-
-                unset($result);
-                $result = $objOplatform->apiQueryAuth($query_auth_code);
-                if (!$result->isSuccess()) {
-                    echo($result->getData());exit();
-                }
-
-                $authorization_info = $result->getData();
-                $authorizer_appid = $authorization_info['authorizer_appid'];
-                $authorizer_access_token = $authorization_info['authorizer_access_token'];
-
-                $miniprogramConfigData = Factory::config()->getAppoint('weixin','miniprogram');
-                if(empty($miniprogramConfigData)){
-                    echo('小程序配置项错误');exit();
-                }
-
-                unset($result);
-                $objMiniprogram = new Miniprogram($miniprogramConfigData['appid'], $miniprogramConfigData['appSecret']);
-                $sendMessage = $query_auth_code.'_from_api';
-                $result = $objMiniprogram->messageCustomSend($authorizer_access_token, $sendMessage,$data['FromUserName']);
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinopen.log', date('Y-m-d H:i:s'). '回调数据' . var_export($result, true) . PHP_EOL, FILE_APPEND);
-                if (!$result->isSuccess()) {
-                    echo($result->getData());exit();
-                }
-                exit('');
-            }
-        }
-
-    }
-
-    /**
-     * 获取预授权码(pre_auth_code)
-     * 官网文档地址: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Authorization_Process_Technical_Description.html
-     */
-    public function preAuthCode()
-    {
-        //获取微信配置
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            exit('配置错误');
-        }
-
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-
-        $result = $objOplatform->preAuthCode();
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-        $pre_auth_code = $result->getData();
-
-        $auth_url = 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=' . $oplatformConfigData['appid'] . '&pre_auth_code=' . $pre_auth_code . '&redirect_uri=' . $this->redirect_uri . '&auth_type=2';
-        parent::sendOutput($auth_url);
-    }
-
-    /**
-     * 接受授权码 authorization_code
-     */
-    public function authorizationCode()
-    {
-        $params = $this->request->getRawJson();
-        $authData = [
-            'auth_code'  => $this->request->param('auth_code'),
-            'expires_in' => $this->request->param('expires_in'),
-        ];
-
-        foreach ($authData as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数为空!', ErrorCode::$paramError);
-            }
-        }
-
-        /*
-       $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-       if (empty($oplatformConfigData)) {
-           parent::sendOutput('微信三方平台配置错误', ErrorCode::$paramError);
-       }*/
-
-        $objMOem = new MOem();
-        $result = $objMOem->getOemInfoByApiDomain($_SERVER['HTTP_HOST']);
-        if( !$result->isSuccess() ){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $oemData = $result->getData();
-        if( empty($oemData) ){
-            parent::sendOutput('oem表中获取配置为空', ErrorCode::$contentNotExists);
-        }
-        $oplatformConfigData = json_decode($oemData['weixinOpen'], true);
-        if( empty($oplatformConfigData) ){
-            parent::sendOutput('oem表中获取微信开放平台配置为空', ErrorCode::$contentNotExists);
-        }
-
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-
-        $result = $objOplatform->apiQueryAuth($authData['auth_code']);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        echo "<script>location.href='http://".$oemData['domain']."/#/AuthorizePage'</script>";
-        //parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 创建小程序接口
-     */
-    public function fastregisterweapp()
-    {
-        $params = $this->request->getRawJson();
-        $componentData = [
-            'enterpriseId' => isset($params['enterpriseId']) ? $params['enterpriseId'] : '',//企业id
-            'name'  => isset($params['name']) ? $params['name'] : '', // 企业名称
-            'code' => isset($params['code']) ? $params['code'] : '', // 企业代码
-            'code_type' => isset($params['code_type']) ? $params['code_type'] : 1, // 企业代码类型(1:统一社会信用代码2:组织机构代码3:营业执照注册号)
-            'legal_persona_wechat' => isset($params['legal_persona_wechat']) ? $params['legal_persona_wechat'] : '', // 法人微信
-            'legal_persona_name' => isset($params['legal_persona_name']) ? $params['legal_persona_name'] : '', // 法人姓名
-            'component_phone' => isset($params['component_phone']) ? $params['component_phone'] : '', // 第三方联系电话
-        ];
-
-        foreach ($componentData as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数为空!', ErrorCode::$paramError);
-            }
-        }
-
-        //根据企业id保存企业数据
-        $objMEnterprise = new Menterprise();
-        $update = [
-            'weChatEnterpriseName' => $componentData['name'],//企业名称
-            'weChatEnterpriseCode' => $componentData['code'],//企业代码
-            'legalPersonaWeChat' => $componentData['legal_persona_wechat'],//法人微信
-            'legalPersonaName' => $componentData['legal_persona_name'],//法人姓名
-            'weChatProgramKey' => md5($componentData['name'].$componentData['code'].$componentData['legal_persona_wechat'].$componentData['legal_persona_name'])//唯一key
-        ];
-
-        $modelResult = $objMEnterprise->updateEnterprise($update,['id' => $componentData['enterpriseId']]);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(),$modelResult->getErrorCode());
-        }
-        unset($componentData['enterpriseId']);
-
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            parent::sendOutput('微信三方平台配置错误', ErrorCode::$paramError);
-        }
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-
-        $result = $objOplatform->fastregisterweappCreate($componentData);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 微信认证名称检测
-     */
-    public function checkwxverifynickname()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'appid' => isset($params['appid']) ? $params['appid'] : '',
-            'nickName'  => isset($params['nickName']) ? $params['nickName'] : '', // 企业名称
-        ];
-
-        foreach ($data as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数为空!', ErrorCode::$paramError);
-            }
-        }
-
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            parent::sendOutput('微信三方平台配置错误', ErrorCode::$paramError);
-        }
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-
-        $result = $objOplatform->checkwxverifynickname($data['appid'], $data['nickName']);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 设置小程序名称
-     */
-    public function setnickname()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'appid' => isset($params['appid']) ? $params['appid'] : '',
-            'nickName'  => isset($params['nickName']) ? $params['nickName'] : '', // 企业名称
-        ];
-
-        foreach ($data as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数为空!', ErrorCode::$paramError);
-            }
-        }
-
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            parent::sendOutput('微信三方平台配置错误', ErrorCode::$paramError);
-        }
-        $objOplatform = new Oplatform($oplatformConfigData['appid'], $oplatformConfigData['token'], $oplatformConfigData['encodingAesKey'], $oplatformConfigData['appSecret']);
-
-        $result = $objOplatform->setnickname($data['appid'], $data['nickName']);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-}

+ 0 - 366
Controller/Common/WeiXinPayNotify.Class.php

@@ -1,366 +0,0 @@
-<?php
-/**
- * 微信支付通知类
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/11/28
- * Time: 5:00 PM
- */
-namespace JinDouYun\Controller\Common;
-
-use JinDouYun\Dao\Finance\DAccountType;
-use JinDouYun\Dao\Finance\DExpenseSingle;
-use JinDouYun\Dao\Market\DVipCardOrder;
-use JinDouYun\Model\Finance\MAccount;
-use JinDouYun\Model\Finance\MExpenseSingle;
-use JinDouYun\Model\Shop\MShopCardOrder;
-use JinDouYun\Model\Shop\MShopSubscribe;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Order\MOrder;
-use JinDouYun\Model\Market\MVipCard;
-use JinDouYun\Model\System\MPaymentSetting;
-
-class WeiXinPayNotify extends BaseController
-{
-    /**
-     * 商户支付密钥
-     */
-    private $partnerKey = '45c87Fa0352211e78D40d4977a9Ea871';
-
-    public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-    }
-
-    /**
-     * 微信回调处理方法
-     */
-    public function notify()
-    {
-
-        $postStr = file_get_contents('php://input');// 将整个文件读入字符串
-        file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/weixinpay.log',date('Y-m-d H:i:s').'回调数据'.var_export($postStr,true).PHP_EOL,FILE_APPEND);
-
-        /*
-        $postStr = '<xml><appid><![CDATA[wxb2198cca99031de1]]></appid>
-<attach><![CDATA[64|80|27]]></attach>
-<bank_type><![CDATA[OTHERS]]></bank_type>
-<cash_fee><![CDATA[1]]></cash_fee>
-<fee_type><![CDATA[CNY]]></fee_type>
-<is_subscribe><![CDATA[N]]></is_subscribe>
-<mch_id><![CDATA[1565202181]]></mch_id>
-<nonce_str><![CDATA[9dbae1af7e660f5a5dde2174060f47d9]]></nonce_str>
-<openid><![CDATA[oEDnY5VI3HIbLQCxLOc88qFun3JQ]]></openid>
-<out_trade_no><![CDATA[vip_tmp322202106228039826320]]></out_trade_no>
-<result_code><![CDATA[SUCCESS]]></result_code>
-<return_code><![CDATA[SUCCESS]]></return_code>
-<sign><![CDATA[4E3D79E8E38A2B35E47BF836589A53FD]]></sign>
-<time_end><![CDATA[20210622184532]]></time_end>
-<total_fee>1</total_fee>
-<trade_type><![CDATA[JSAPI]]></trade_type>
-<transaction_id><![CDATA[4200001172202106224897300202]]></transaction_id>
-</xml>';
-        */
-        
-        if (!empty($postStr)) {
-            libxml_disable_entity_loader(true);//  禁用加载外部实体的功能
-            // 先做签名校验
-            $data = json_decode(json_encode(simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
-            ksort($data);//根据下标进行排序
-            $buff = '';
-            foreach ($data as $k => $v){
-                if($k != 'sign'){
-                    $buff .= $k . '=' . $v . '&';
-                }
-            }
-
-            if(empty($data['attach'])){
-                $this->weixinErrorEcho('附加数据为空');
-            }
-            $attach = explode('|', $data['attach']);
-
-            $enterpriseId = $attach[0];
-            unset($attach[0]);
-            $userCentId = $attach[1];
-            unset($attach[1]);
-
-            //获取支付配置
-            $objMPaymentSetting = new MPaymentSetting($userCentId, $enterpriseId);
-            $result = $objMPaymentSetting->getPayData(StatusCode::$payType['wxPay']);
-            if (!$result->isSuccess() || empty($result->getData())) {
-                $this->weixinErrorEcho('获取微信配置错误');
-            }
-            $payment = $result->getData();
-
-            /*
-            $weixinPayConfigData = Factory::config()->getAppoint('weixin', 'pay');
-            if(empty($weixinPayConfigData)){
-                $this->weixinErrorEcho('微信配置错误');
-            }
-
-            $stringSignTemp = $buff . 'key='.$weixinPayConfigData['apiPartnerKey'];*/
-
-
-            $stringSignTemp = $buff . 'key='.$payment['apiPartnerKey'];
-            $sign = strtoupper(md5($stringSignTemp)); //加密后将所有字母转换成大写
-            if($sign !== $data['sign']){
-                $this->weixinErrorEcho('签名错误');
-            }
-            //  函数转换形式良好的 XML 字符串为 SimpleXMLElement 对象。
-            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
-            //通信标识
-            if ($postObj->return_code == 'SUCCESS') {
-                //业务结果
-                if ($postObj->result_code == 'SUCCESS') {
-
-                    $response_content = (array)$postObj;
-                    $data = array(
-                        'attach'         => $response_content['attach'], // 附加数据
-                        'transaction_id' => $response_content['transaction_id'], // 微信支付订单号
-                        'out_trade_no'   => $response_content['out_trade_no'],  // 商户订单号
-                        'time_end'       => $response_content['time_end'],      // 支付完成时间
-                        'total_fel'      => $response_content['total_fee'] / 100, //支付金额(转化为元)
-                    );
-
-                    if(empty($data['attach'])){
-                        $this->weixinErrorEcho('附加数据为空');
-                    }
-                    $attach = explode('|', $data['attach']);
-
-
-                    $enterpriseId = $attach[0];
-                    unset($attach[0]);
-                    $userCentId = $attach[1];
-                    unset($attach[1]);
-
-                    $allOrdersId = array_values($attach);
-
-
-                    //处理销售订单
-                    if (strpos( $data['out_trade_no'],'tmp') === false || substr($data['out_trade_no'],0,3) == 'tmp') {
-                        $updateOrderData = [
-                            'outerTradeNo' => $data['transaction_id'],
-                            'payType' => StatusCode::$payType['wxPay'],
-                            'payStatus' => StatusCode::$standard,
-                            'orderStatus' => StatusCode::$orderStatus['waitDelivery'],
-                            'payTime' => strtotime($data['time_end']),
-                            'total_fel'=> $data['total_fel'],
-                            'pay_way'=>StatusCode::$payType['wxPay']
-                        ];
-
-                        $objMOrder = new MOrder($userCentId, $enterpriseId);
-                        if(strpos( $data['out_trade_no'],'tmp') === false){
-                            $result = $objMOrder->updateOrderPayData($updateOrderData, ['id'=>$allOrdersId,'no'=>$data['out_trade_no']],true);// 修改订单的支付状态
-                        }else{
-                            $result = $objMOrder->updateOrderPayData($updateOrderData, ['id'=>$allOrdersId,'outerTradeNo'=>$data['out_trade_no']],true);// 修改订单的支付状态
-                        }
-
-                        if($result->isSuccess()){
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToWeiXinXml($result);// 数组转xml
-                            exit();
-                        }else{
-                            $this->weixinErrorEcho($result->getData());
-                        }
-                    }
-
-                    //处理会员卡订单
-                    if (strpos( $data['out_trade_no'],'tmp') !== false && substr($data['out_trade_no'],0,3) == 'vip') {
-                        $vipOrderData = [
-                            'outerTradeNo' => $data['transaction_id'],
-                            'payType' => StatusCode::$payType['wxPay'],
-                            'payStatus' => StatusCode::$standard,
-                            'payTime' => strtotime($data['time_end']),
-                        ];
-
-                        $objMVipCard = new MVipCard($enterpriseId, $userCentId);
-                        // 修改订单支付状态,支付成功后赠送对应优惠券
-                        $result = $objMVipCard->updateVipOrderPayData($vipOrderData, ['id'=>$allOrdersId,'outerTradeNo'=>$data['out_trade_no']],true);
-
-                        // 会员卡订单表
-                        $objDVipCard = new DVipCardOrder();
-                        $objDVipCard->setTable('qianniao_vip_card_order_'.$enterpriseId);
-                        // 费用类型
-                        $objDAccountType = new DAccountType('finance');
-                        $objDAccountType->setTable('qianniao_account_type');
-                        if($result->isSuccess()){
-                            //微信回调方法,新增一条已审核的费用单
-                            //判断有无会员卡消费费用类型
-                            $accountTypeResult = $objDAccountType->query('select * from qianniao_account_type where type = '.StatusCode::$standard.' and name like "%会员卡%"');
-                            if($accountTypeResult === false){
-                                $this->weixinErrorEcho($objDAccountType->error());
-                            }
-                            if(empty($accountTypeResult)){ //没有创建一个收入的会员卡消费类型
-                                $accountTypeDate = [
-                                    'enterpriseId' => $enterpriseId,
-                                    'name' => '会员卡',
-                                    'type' => StatusCode::$standard,
-                                    'remarks' => '购买会员卡',
-                                    'createTime' => time()
-                                ];
-                                $accountTypeInsert = $objDAccountType->insert($accountTypeDate);
-                                if($accountTypeInsert === false){
-                                    $this->weixinErrorEcho($objDAccountType->error());
-                                }
-                            }
-
-                            //查询当前会员卡订单信息
-                            foreach ($allOrdersId as $cardOrderId) {
-                                $vipCardResult = $objDVipCard->get($cardOrderId);
-                                if($vipCardResult === false){
-                                    $this->weixinErrorEcho($objDVipCard->error());
-                                }
-                                //获取微信默认账户信息
-                                $objMAccount = new MAccount($enterpriseId, $userCentId);
-                                $defaultAccountResult = $objMAccount->getDefaultAccount($vipCardResult['payType']);
-
-                                if ($defaultAccountResult->isSuccess() == false) {
-                                    $this->weixinErrorEcho($defaultAccountResult->getData());
-                                }
-                                $defaultAccount = $defaultAccountResult->getData();
-                                if(empty($defaultAccount)){
-                                    $this->weixinErrorEcho('支付方式对应的银行账户为空');
-                                }
-                                
-                                //组装费用单信息
-                                $expenseSingleData = [
-                                    'currentUnitId'           => $vipCardResult['customerId'],
-                                    'currentUnit'             => $vipCardResult['customerName'],
-                                    'type'                    => StatusCode::$delete,
-                                    'billTime'                => time(),
-                                    'manager'                 => '',
-                                    'shopId'                  => $vipCardResult['shopId'],
-                                    'shopName'                => '',
-                                    'consumeTypeId'           => !empty($accountTypeResult)? $accountTypeResult[0]['id'] : $accountTypeInsert,
-                                    'consumeTypeName'         => !empty($accountTypeResult)? $accountTypeResult[0]['name'] : $accountTypeDate['name'],
-                                    'totalCollectionAmount'   => $vipCardResult['payAmount'],
-                                    'totalPreferentialAmount' => 0,
-                                    'totalActualAmount'       => $vipCardResult['payAmount'],
-                                    'payType'                 => StatusCode::$standard,
-                                    'auditStatus'             => StatusCode::$auditStatus['auditing'],
-                                    'deleteStatus'            => StatusCode::$standard,
-                                    'expenseSingleAccountDate'=> [
-                                        [
-                                            'expenseName' => 'vip会员卡收入',
-                                            'amount' => $vipCardResult['payAmount'],
-                                            'settlementMethodId' => StatusCode::$payType['wxPay'],
-                                            'settlementAccount' => StatusCode::$payType[1],
-                                            'accountId' => $defaultAccount['id'],
-                                            'preferentialAmount' => 0
-                                        ]
-                                    ]
-                                ];
-
-                                // 添加一条费用单
-                                $objMExpenseSingle = new MExpenseSingle($enterpriseId, $userCentId);
-                                $expenseSingleResult = $objMExpenseSingle->addExpenseSingle($expenseSingleData);
-                                if ($expenseSingleResult->isSuccess() == false) {
-                                    $this->weixinErrorEcho($expenseSingleResult->getData());
-                                }
-                                //审核
-                                $updateExpenseSingle = $objMExpenseSingle->updateExpenseStatus(['id'=>$expenseSingleResult->getData(),'createTime'=>time()]);
-                                if ($updateExpenseSingle->isSuccess() == false) {
-                                    $this->weixinErrorEcho($updateExpenseSingle->getData());
-                                }
-                            }
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToXml($result); // 数组转xml内容
-                            exit();
-                        }else{
-                            $this->weixinErrorEcho($result->getData());
-                        }
-                    }
-
-                    //处理预约项目订单
-                    if (substr($data['out_trade_no'],0,2) == 'wx') {
-                        $Msub = new MShopSubscribe($enterpriseId);
-                        $subOrder = $Msub->details(['order_id' => $data['out_trade_no']]);
-                        $subOrder = $subOrder->getData();
-                        if ($subOrder['paid'] == 1){
-                            //已支付
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToXml($result); // 数组转xml内容
-                            exit();
-                        }
-
-                        $res = $Msub->paySuccess($data['out_trade_no']);
-                        if ($res){
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToXml($result); // 数组转xml内容
-                            exit();
-                        }else{
-                            $this->weixinErrorEcho('失败');
-                        }
-                    }
-
-                    //处理优惠卡订单
-                    if (substr($data['out_trade_no'],0,2) == 'car') {
-                        $Mcard = new MShopCardOrder($enterpriseId);
-                        $order = $Mcard->details(['order_id' => $data['out_trade_no']]);
-                        $order = $order->getData();
-                        if ($order['paid'] == 1){
-                            //已支付
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToXml($result); // 数组转xml内容
-                            exit();
-                        }
-
-                        $res = $Mcard->paySuccess($data['out_trade_no']);
-                        if ($res){
-                            $result = array(
-                                'return_code' => 'SUCCESS',
-                                'return_msg'  => 'OK',
-                            );
-                            echo arrayToXml($result); // 数组转xml内容
-                            exit();
-                        }else{
-                            $this->weixinErrorEcho('失败');
-                        }
-                    }
-
-
-                    $this->weixinErrorEcho('out_trade_no错误');
-                } else {
-                    $this->weixinErrorEcho($postObj->err_code.':'.$postObj->err_code_des);
-                }
-            } else {
-                $this->weixinErrorEcho($postObj->return_msg);
-            }
-        }else{
-            $this->weixinErrorEcho('微信回调数据为空');
-        }
-    }
-
-    /**
-     * 统一错误输出
-     */
-    public function weixinErrorEcho($errorMsg){
-        $result = array(
-            'return_code' => 'FAIL',
-            'return_msg'  => $errorMsg,
-        );
-        echo arrayToWeiXinXml($result);
-        exit();
-    }
-}

+ 0 - 289
Controller/Common/XinHongTai.Class.php

@@ -1,289 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2021/4/28
- * Time: 3:54 PM
- */
-
-namespace Jindouyun\Controller\Common;
-
-use JinDouYun\Cache\SysAreaChinaCache;
-
-use Jindouyun\Model\Customer\MCustomer;
-use Jindouyun\Model\Goods\MQuickGoods;
-use Jindouyun\Model\GoodsCategory\MGoodsCategory;
-use JinDouYun\Model\Commission\MCommissionBusinessman;
-
-use Jindouyun\Dao\Customer\DCustomer;
-use Jindouyun\Dao\Goods\DGoods;
-use Mall\Framework\Core\StatusCode;
-
-class XinHongTai
-{
-    /**
-     * 导入客户数据
-     */
-    public function customer()
-    {
-        $objSysAreaChinaCache = new SysAreaChinaCache();
-        $objDCustomer = new DCustomer('old');
-        $objMCustomer = new MCustomer(1, 1);
-
-        // 查询会员表获取客户信息
-        $sql = 'select count(*) as total from ims_ewei_shop_member';
-        $result = $objDCustomer->query($sql);
-
-        // 查询会员表获取客户信息
-        $sql = 'select id,mobile,realname,nickname,isblack,avatar,content,createtime,province,city,area,openid from ims_ewei_shop_member where id < 2 order by id DESC';
-        $result = $objDCustomer->query($sql);
-
-        foreach ($result as $key => $value){
-            $customerData = [
-                'id'     => $value['id'],
-                'mobile' => ($value['mobile']) ? : time().substr(microtime(),2,1),
-                'name'   => (!empty($value['realname'])) ? $value['realname'] : $value['nickname'],
-                'type'   => 3, // 默认散户
-                'enableStatus' => ($value['isblack']) ? 4 : 5, // 老系统黑名单 新系统禁用
-                'avatar' => $value['avatar'],
-                'remark' => $value['content'],
-                'createTime' => $value['createtime'],
-                'provinceCode' => $objSysAreaChinaCache->getCodeByName($value['province']),
-                'cityCode' => $objSysAreaChinaCache->getCodeByName($value['city']),
-                'districtCode' => ($value['area']) ? $objSysAreaChinaCache->getCodeByName($value['area']) : 0,
-
-                'contact' => [],
-            ];
-
-            // 查询收货地址
-            $sql = 'select * from ims_ewei_shop_member_address where deleted = 0 and openid = '.$value['openid'].' order by id DESC limit 1 ';
-            $result = $objDCustomer->query($sql);
-            if(!empty($result)){
-                $customerData['name'] = $result[0]['realname'];
-                $customerData['mobile'] = $result[0][''];
-                $customerData['provinceCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['province']);
-                $customerData['cityCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['city']);
-                $customerData['districtCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['area']);
-                $customerData['address'] =  $result[0]['address'];
-
-                $customerData['contact']['name'] = $result[0]['realname'];
-                $customerData['contact']['mobile'] = $result[0][''];
-                $customerData['contact']['provinceCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['province']);
-                $customerData['contact']['cityCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['city']);
-                $customerData['contact']['districtCode'] = $objSysAreaChinaCache->getCodeByName($result[0]['area']);
-                $customerData['contact']['address'] =  $result[0]['address'];
-            }
-
-            $result = $objMCustomer->addCustomer($customerData);
-            if(!$result->isSuccess()){
-                echo $result->getData();
-                exit();
-            }
-            echo $value['id'].'迁移客户数据完成'.PHP_EOL;
-            //sleep(1);
-        }
-    }
-
-    /**
-     * 迁移分销关系
-     */
-    public function commission()
-    {
-        $objDCustomer = new DCustomer('old');
-        $objMCommissionBusinessman = new MCommissionBusinessman(1, 1);
-
-        // 查询会员表获取客户信息
-        $sql = 'select id,mobile,realname,nickname,isblack,avatar,content,createtime,province,city,area,openid,agentid from ims_ewei_shop_member where id > 16168 order by id asc';
-        $result = $objDCustomer->query($sql);
-
-        $objDCustomer = new DCustomer('default');
-        foreach ($result as $key => $value){
-            // 没有推荐人不做处理
-            if($value['agentid'] == 0){
-                continue;
-            }
-
-            // 上级客户信息
-            $sql = 'select * from qianniao_customer_1 where id = '.$value['agentid'];
-            $customerData = $objDCustomer->query($sql);
-            if($customerData === false){
-                echo $objDCustomer->error().PHP_EOL;
-                exit();
-            }
-            if(empty($customerData)){
-                echo $value['agentid'].'获取上级代理信息为空'.PHP_EOL;
-                continue;
-            }
-
-            echo $value['agentid'].'准备创建分销商'.PHP_EOL;
-            // 先把推荐人申请成为分销商
-            $businessman = [
-                'customerId' => $value['agentid'],
-                'gradeId' => 1,
-                'grade'   => 0,
-            ];
-            $result = $objMCommissionBusinessman->addBusinessman($businessman);
-            if(!$result->isSuccess()){
-                if($result->getData() != '该客户已经是分销商'){
-                    echo $result->getData().PHP_EOL;
-                    exit();
-                }else{
-                    echo $result->getData().PHP_EOL;
-                }
-            }
-            echo $value['agentid'].'成为分销商成功'.PHP_EOL;
-
-
-            // 要绑定客户信息
-            $sql = 'select * from qianniao_customer_1 where id = '.$value['id'];
-            $customerData = $objDCustomer->query($sql);
-            if($customerData === false){
-                echo $objDCustomer->error().PHP_EOL;
-                exit();
-            }
-            if(empty($customerData)){
-                echo $value['agentid'].'获取绑定客户信息为空'.PHP_EOL;
-                continue;
-            }
-
-            // 绑定当前用户和分销商的关系
-            $data = [
-                'businessmanId' => $value['agentid'],
-                'source' => 1,
-            ];
-            $objMCommissionBusinessman = new MCommissionBusinessman(1,  $customerData[0]['userCenterId']);
-            $result = $objMCommissionBusinessman->relationshipBusinessman($data);
-            if(!$result->isSuccess()){
-                echo $result->getData().PHP_EOL;
-                exit();
-            }
-            echo $value['agentid'].' 创建分销商成功,'.$value['id'].' 和分销商绑定关系完成'.PHP_EOL;
-        }
-    }
-
-    /**
-     * 分类
-     */
-    public function category()
-    {
-        $objDGoods = new DGoods('old');
-        $objMGoodsCategory = new MGoodsCategory(1,1);
-
-
-        // 查询商品表获取商品信息
-        $sql = 'select *  from ims_ewei_shop_category';
-        $result = $objDGoods->query($sql);
-
-        foreach ($result as $key => $value){
-            $categoryData = [
-                'title' => $value['name'],
-                'sort'  => $value['displayorder'],
-                'images' => 'https://xinhongtai168.com/attachment/'.$value['advimg'],
-            ];
-            $result = $objMGoodsCategory->addCategory($categoryData);
-            if(!$result->isSuccess()){
-                echo $result->getData();
-                exit();
-            }
-
-            echo $value['id'].'迁移商品分类数据完成'.PHP_EOL;
-        }
-    }
-
-    /**
-     * 商品资料
-     */
-    public function goods()
-    {
-        $objDGoods = new DGoods('old');
-        $objMQuickGoods = new MQuickGoods(1,1);
-
-        // 查询商品表获取商品信息
-        $sql = 'select id,title,cates,thumb_url,thumb,marketprice,productprice,content,subtitle,keywords,displayorder,status from ims_ewei_shop_goods where id < 1435  order by id desc ';
-        $result = $objDGoods->query($sql);
-
-        foreach ($result as $key => $value){
-            // 处理商品分类
-            $cates = explode(',', $value['cates']);
-            $categoryId = array_shift($cates);
-            $assistCategoryId = 0;
-            $assistCategoryPath = [];
-            if(!empty($cates)){
-                $assistCategoryId = implode(',', $cates);
-                $assistCategoryPath = $cates;
-            }
-
-            // 处理图片
-            $thumb_url = ($value['thumb_url']) ? unserialize($value['thumb_url']) : [];
-            $thumb = ($value['thumb']) ? [$value['thumb']] : [];
-            $image = array_merge($thumb,$thumb_url);
-            if(!empty($image)){
-                foreach ($image as $k => $v){
-                    $image[$k] = 'https://xinhongtai168.com/attachment/'.$v;
-                }
-            }
-
-            $goodsData = [
-                'createUserName' => '老系统迁移',
-                'merchantId' => 0,
-                'specGroup' => json_encode([]),
-                'notArea'  => json_encode(''),
-                'link'  => '',
-                'barCode' => '',
-                'expireTime' => 0,
-                'brandId' => 0,
-                'title' => $value['title'],
-                'categoryId' => ($categoryId) ? $categoryId : 0,
-                'categoryPath' => $categoryId,
-                'assistCategoryId' => $assistCategoryId,
-                'assistCategoryPath' => json_encode($assistCategoryPath),
-                'images' => json_encode($image),
-                'shopId' => 1,
-                'shopName' => '鑫弘泰食品商城',
-                'specType' => 1,
-                'specMultiple' => [
-                    [
-                        'barCode' => '',
-                        'weight' => '',
-                        'isDefault' => 5,
-                        'unitId' => 1,
-                        'unitName' => '件',
-                        'isMaster' => 5,
-                        'conversion' => '0.00',
-                        'specImage' => '',
-                        'specGroup' => [],
-                        'salePrice' =>[
-                            'conversion' => '0.00',
-                            'unitName' => '件',
-                            'unitId' => 1,
-                            'isMaster' => 5,
-                            'deleteStatus' => 4,
-                            'enabledLadder' => 0,
-                            'salePriceAreaType' => 1,
-                            'salePrice' => $value['marketprice'],
-                            'ladderPrice' => [],
-                            'marketPrice' => $value['productprice'],
-                            'setNum' => 1,
-                        ],
-                        'customerTypePrice' => [],
-                        'customerPrice' => []
-                    ]
-                ],
-                'isStore' => false,
-                'description' => $value['content'],
-                'describe' => $value['subtitle'],
-                'tag' => $value['keywords'],
-                'sort' => $value['displayorder'],
-                'enableStatus' => ($value['status']) ? StatusCode::$standard : StatusCode::$delete,
-                'noSalesShop'  => '',
-            ];
-
-            $result = $objMQuickGoods->addBasicAndPublishGoods($goodsData);
-            if(!$result->isSuccess()){
-                echo $result->getData();
-                exit();
-            }
-            echo $value['id'].'商品数据完成'.PHP_EOL;
-        }
-    }
-}

+ 0 - 46
Controller/Cron/CouponCron.Class.php

@@ -1,46 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/16
- * Time: 9:41
- */
-
-namespace JinDouYun\Controller\Cron;
-
-
-use JinDouYun\Dao\Enterprise\DEnterprise;
-use JinDouYun\Model\Market\MCoupon;
-use Mall\Framework\Core\StatusCode;
-
-class CouponCron
-{
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/9/3
-     * Time: 11:56 上午
-     * @throws \Exception
-     */
-    public function grantCoupon()
-    {
-        $objDEnterprise = new DEnterprise();
-        $objDEnterprise->setTable('qianniao_enterprise_1');
-        $enterpriseList = $objDEnterprise->select(['deleteStatus' => StatusCode::$standard]);
-        if ($enterpriseList === false){
-            echo 'sql错误'.$objDEnterprise->error();
-            echo PHP_EOL;
-            die;
-        }
-        foreach ($enterpriseList as $value){
-            $objMCoupon = new MCoupon('',$value['id']);
-            $res =$objMCoupon->grantCoupon();
-            if (!$res->isSuccess()){
-                echo '执行错误'.$res->getData();
-                echo PHP_EOL;
-                die;
-            }
-        }
-        echo '执行结束'.PHP_EOL;
-    }
-}

+ 0 - 32
Controller/Cron/Cron.Class.php

@@ -1,32 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Cron;
-
-/**
- * Trait Cron
- * @package JinDouYun\Controller\Cron
- */
-trait Cron
-{
-    /**
-     * Doc: (des="计划任务信息统一输出")
-     * User: XMing
-     * Date: 2020/11/20
-     * Time: 12:00 下午
-     * @param string $name
-     * @param $msg
-     * @param bool $exit
-     */
-    public static function sendOutput(string $name,$msg = '',bool $exit = false)
-    {
-        !is_string($msg) && $msg = json_encode($msg,320);
-        $debug = '';
-        $debug .= '['.date('Y-m-d H:i:s').']';
-        $debug .= ' '.__CLASS__.' ';
-        !empty($name) && $debug .= $name;
-        !empty($msg) && $debug .= ': '.$msg;
-        echo $debug.PHP_EOL;
-        if ($exit === true) die();
-    }
-}

+ 0 - 109
Controller/Cron/CustomerCron.Class.php

@@ -1,109 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/14
- * Time: 15:45
- */
-
-namespace JinDouYun\Controller\Cron;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use JinDouYun\Cache\CustomerCache;
-use JinDouYun\Dao\Market\DVipCardOrder;
-use Mall\Framework\Core\StatusCode;
-
-class CustomerCron
-{
-
-    private $objCustomerCache;
-    private $objDVipCardOrder;
-
-    public function __construct()
-    {
-        $this->objCustomerCache = new CustomerCache();
-        $this->objDVipCardOrder = new DVipCardOrder('default');
-    }
-
-    //删除redis中一个月前注册的客户
-    public function delCustomerOfOneMonthAgo()
-    {
-        $result = $this->objCustomerCache->delCustomerOfOneMonthAgo();
-        if ($result) {
-            echo "删除30天前注册的客户--成功";
-            die;
-        }
-        echo "删除30天前注册的客户--失败";
-    }
-
-    //删除redis中7天前有加购行为的客户
-    public function delInterestCustomerOfSevenDaysAgo()
-    {
-        $result = $this->objCustomerCache->delInterestCustomerOfSevenDaysAgo();
-        if ($result) {
-            echo "删除7天有加购行为的客户--成功";
-            die;
-        }
-        echo "删除7天有加购行为的客户--失败";
-    }
-
-    //每半小时执行一次,把下单超过半小时仍未支付的订单删掉
-    public function AutoDelNoPayVipCardOrder() {
-        $sql = "show tables like 'qianniao_vip_card_order_%';";
-        $tables = $this->objDVipCardOrder->query($sql);
-        if (empty($tables)) {
-            echo "无会员卡订单表";
-            die;
-        }
-
-        $vipCardOrderTables = [];
-        foreach ($tables as $tableArr) {
-            foreach ($tableArr as $table) {
-                if (strpos($table,'qianniao_vip_card_order_') !== false) {
-                    $vipCardOrderTables[] = $table;
-                }
-            }
-        }
-
-        if (empty($vipCardOrderTables)) {
-            echo "无会员卡订单表";
-            die;
-        }
-
-        $this->objDVipCardOrder->beginTransaction();
-        foreach ($vipCardOrderTables as $vipCardOrderTable) {
-            $enterpriseId = substr($vipCardOrderTable,strlen('qianniao_vip_card_order_'));
-
-            $endTime = time()- 30 * 60;
-            $sql = 'SELECT * FROM '.$vipCardOrderTable.' WHERE payStatus='.StatusCode::$delete.' AND createTime <='.$endTime;
-
-            $orders = $this->objDVipCardOrder->query($sql);
-            if ($orders === false) {
-                $this->objDVipCardOrder->rollBack();
-                file_put_contents('/www/wwwroot/cron.log',date('Y-m-d H:i:s').'查询会员卡订单表失败'.var_export($orders,true).PHP_EOL,FILE_APPEND);
-            }
-
-            //循环处理订单   把会员卡销售数量减1,并删除订单
-            if (!empty($orders)) {
-                foreach ($orders as $order) {
-                    $sql = "UPDATE qianniao_vip_card_".$enterpriseId.' SET num=num -1 where id='.$order['vipCardId'];
-                    $result = $this->objDVipCardOrder->query($sql);
-                    if ($result === false) {
-                        $this->objDVipCardOrder->rollBack();
-                        file_put_contents('/www/wwwroot/cron.log',date('Y-m-d H:i:s').'修改会员卡销售数量失败'.var_export($result,true).PHP_EOL,FILE_APPEND);
-                    }
-
-                    $sql = "DELETE FROM ".$vipCardOrderTable.' where id='.$order['id'];
-                    $dbResult = $this->objDVipCardOrder->query($sql);
-                    if ($dbResult === false) {
-                        $this->objDVipCardOrder->rollBack();
-                        file_put_contents('/www/wwwroot/cron.log',date('Y-m-d H:i:s').'删除会员卡订单失败'.var_export($result,true).PHP_EOL,FILE_APPEND);
-                    }
-                }
-            }
-        }
-        $this->objDVipCardOrder->commit();
-
-    }
-}

+ 0 - 133
Controller/Cron/DelayQueueOrder.Class.php

@@ -1,133 +0,0 @@
-<?php
-namespace JinDouYun\Controller\Cron;
-
-use JinDouYun\Controller\Common\Logger;
-use Mall\Framework\Factory;
-use Mall\Framework\Cache\Redis;
-
-/**
- * Description: redis延时队列,订单延时取消
- * Class DelayQueueOrder
- * @package JinDouYun\Controller\Cron
- */
-class DelayQueueOrder
-{
-
-    /**
-     * @var Redis
-     */
-    private $cache;
-
-    /**
-     * @var string
-     */
-    private $delayQueueCancelOrderKey = 'delay_queue_cancel_order';
-
-    /**
-     * @var int
-     */
-    private $enterpriseId;
-
-    /**
-     * DelayQueueOrder constructor.
-     * @throws \Exception
-     */
-    public function __construct()
-    {
-        $this->cache = Factory::cache('default');
-        $params = self::cliParams();
-        if (empty($params)){
-            Logger::logs(E_USER_ERROR,'命令行参数为空',__CLASS__,__LINE__,$params,true);
-            exit();
-        }
-        $enterpriseId = isset($params['enterpriseId']) ? $params['enterpriseId'] : null;
-        if (empty($enterpriseId)){
-            Logger::logs(E_USER_ERROR,'enterpriseId参数错误',__CLASS__,__LINE__,true);
-            exit();
-        }
-        $this->enterpriseId = $enterpriseId;
-    }
-
-    /**
-     * Doc: (des="延时队列,取消订单")
-     * User: XMing
-     * Date: 2020/9/23
-     * Time: 2:36 下午
-     */
-    public function run()
-    {
-        while (true){
-            //从有序集合中拿到n秒以前的订单
-            //TODO 这里要解决每个企业配置不同的订单失效时间问题 (通过命令行传餐 每个企业运行独立的延迟队列)
-            //TODO 不能放在初始化中查询企业配置,企业配置是动态的(5分钟查询一次当前企业最新配置)
-            $orderIds = $this->cache->zrangebyscore($this->delayQueueCancelOrderKey.'::'.$this->enterpriseId, 0, time()-60, ['withscores' => TRUE]);
-            if(empty($orderIds)){
-                sleep(1);
-                continue;
-            }
-            //拿出的数据立马删除
-            foreach ($orderIds as $orderId => $taskTime) {
-                $delRes = $this->cache->zrem($this->delayQueueCancelOrderKey.'::'.$this->enterpriseId, $orderId);
-                if (!$delRes){
-                    continue;
-                }
-                Logger::logs(E_USER_ERROR,'消费订单',__CLASS__,__LINE__,$orderId,true);
-            }
-        }
-    }
-
-    /**
-     * Doc: (des="获取命令行下传递进来的参数")
-     * User: XMing
-     * Date: 2020/9/23
-     * Time: 4:09 下午
-     * @example php test.php -p3 -t=abc --opt=valopt --opt2 valopt2
-     * @return array
-     */
-    private function cliParams()
-    {
-        $result = array();
-        $params = $GLOBALS['argv'];
-
-        array_shift($params);
-        do {
-            $tmpEachResult = array_shift($params);
-            if (!$tmpEachResult) {
-                break;
-            }
-            $p = $tmpEachResult;
-            if ($p{0} == '-') {
-                $pname = substr($p, 1);
-                $value = false;
-                if ($pname{0} == '-') {// 长选项 (--<param>)
-                    $pname = substr($pname, 1);
-                    if (strpos($p, '=') !== false) {
-                        // value specified inline (--<param>=<value>)
-                        list($pname, $value) = explode('=', substr($p, 2), 2);
-                    }
-                } else {// 短选项
-                    if (strpos($p, '=') !== false) {
-                        // value specified inline (-<param>=<value>)
-                        list($pname, $value) = explode('=', substr($p, 1), 2);
-                    } else if (strlen($p) > 1) {
-                        $pname = substr($p, 1, 1);
-                        $value = substr($p, 2);
-                    }
-                }
-                # 如果上面没有取到值,并且下一个不是以-开头的,则下一个值为当前参数的值
-                $nextparm = current($params);
-                if ($value === false
-                    && $nextparm !== false
-                    && $nextparm{0} != '-'
-                ) {
-                    $value = array_shift($params);
-                }
-                $result[$pname] = (string)$value;// 将 false转为空串,以便与http访问时对参数的处理一致
-            } else {
-                # 不是以-指定开始的参数,一律丢弃
-                //$result[] = $p;
-            }
-        } while (true);
-        return $result;
-    }
-}

+ 0 - 138
Controller/Cron/FinanceCron.Class.php

@@ -1,138 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/14
- * Time: 15:45
- */
-
-namespace JinDouYun\Controller\Cron;
-
-use JinDouYun\Cache\FinanceCache;
-
-use JinDouYun\Model\Finance\MReceive;
-use JinDouYun\Model\Finance\MReceived;
-use JinDouYun\Model\Finance\MPay;
-
-use JinDouYun\Dao\Finance\DReceivedReceiptCheckQueue;
-
-class FinanceCron
-{
-
-    private $objFinanceCache;
-    private $objMReceive;
-    private $objMReceived;
-    private $objDReceivedReceiptCheckQueue;
-
-    public function __construct()
-    {
-        $this->objFinanceCache = new FinanceCache();
-        $this->objDReceivedReceiptCheckQueue = new DReceivedReceiptCheckQueue('finance');
-    }
-
-    // 自动审核应付单
-    public function autoAuditPayReceipt()
-    {
-        $result = $this->objFinanceCache->getExistPayEnterprise();
-        if(!$result){
-            echo '没有企业下有应付单需要去审核'.PHP_EOL;
-            return false;
-        }
-
-        // 每个企业去单独处理
-        foreach ($result as $key => $value){
-            // 查询指定企业下所有未审核的应付单
-            $objMPay  =new MPay($value, 0);
-            $payReceiptData = $objMPay->getAllAuditingPay();
-            if(!$payReceiptData->isSuccess()){
-                echo $payReceiptData->getData().PHP_EOL;
-                continue;
-            }
-            $payReceiptData = $payReceiptData->getData();
-
-            foreach ($payReceiptData as $k => $v){
-                $params = [
-                    'createTime' => $v['createTime'],
-                    'id'         => $v['payReceiptId'],
-                ];
-                $updateResult = $objMPay->updatePayStatus($params);
-                if(!$updateResult->isSuccess()){
-                    echo '应付审核失败:原因是---'.$updateResult->getData().PHP_EOL;
-                    continue;
-                }
-            }
-
-            // 处理完一个企业删除一个企业
-            $this->objFinanceCache->delExistPayEnterprise($value);
-            unset($params);
-        }
-
-    }
-
-    //自动审核销售出库应收单
-    public function ReviewReceiveReceipt()
-    {
-        $result = $this->objFinanceCache->getAllSalesOutReceive();
-        if (!$result) {
-            echo "没有需要审核的应收单据". PHP_EOL;;
-            return false;
-        }
-
-        foreach ($result as $key => $value) {
-            $this->objMReceive = new MReceive($key, false);
-            foreach ($value as $params) {
-                $dbResult = $this->objMReceive->updateReceiveStatus($params);
-                if ($dbResult->isSuccess()) {
-                    $this->objFinanceCache->delSalesOutReceive($key, $params['id']);
-                    echo "应收单审核成功 -- id: ". $params['id'] . ', 所属表: '. date('Y', $params['createTime']) . '_' . ceil(date('m', $params['createTime']) / 3);
-                } else {
-                    echo "应收单审核失败,失败原因:" . $dbResult->getData();
-                }
-            }
-        }
-    }
-
-    //自动审核收款单队列中的数据,并删除记录
-    public function AutoCheckReceivedReceipt() {
-        $dbResult = $this->objDReceivedReceiptCheckQueue->select();
-
-        if($dbResult === false){
-            echo "收款单审核错误,原因:" . $this->objDReceivedReceiptCheckQueue->error();die;
-        }
-
-        if(empty($dbResult)) {
-            echo "暂无需要审核的收款单". PHP_EOL;;die;
-        }
-
-        foreach ($dbResult as $record) {
-            $this->objMReceived = new MReceived($record['enterpriseId'], false);
-            $params = [
-                'no'=>$record['receivedNo'],
-                'createTime'=>$record['createTime'],
-            ];
-            $updateResult = $this->objMReceived->updateReceivedStatus($params);
-            if($updateResult->isSuccess() == false) {
-                echo "企业".$record['enterpriseId']."下的收款单".$record['receivedNo']."审核失败001,原因:" . $updateResult->getData();
-                if($updateResult->getData()=="当前收款单已经审核过了"){
-                    echo "正在删除失效队列记录";
-                    $result = $this->objDReceivedReceiptCheckQueue->delete($record['id']);
-                    if($result === false){
-                    echo "队列记录删除失败,原因:".$this->objDReceivedReceiptCheckQueue->error();
-                    } else {
-                        echo "队列记录删除成功";
-                    }
-                }
-            } else {
-                //审核成功后删除队列数据
-                echo "企业".$record['enterpriseId']."下的收款单".$record['receivedNo']."审核成功,正在删除队列记录". PHP_EOL;;
-                $result = $this->objDReceivedReceiptCheckQueue->delete($record['id']);
-                if($result === false){
-                    echo "队列记录删除失败,原因:".$this->objDReceivedReceiptCheckQueue->error();
-                } else {
-                    echo "队列记录删除成功";
-                }
-            }
-            echo PHP_EOL;
-        }
-    }
-}

+ 0 - 71
Controller/Cron/GetWxAuditStatus.Class.php

@@ -1,71 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2020/5/8
- * Time: 15:01
- */
-
-namespace JinDouYun\Controller\Cron;
-
-
-use JinDouYun\Dao\System\DEnterpriseBindTemplate;
-use JinDouYun\Model\System\MEnterpriseBindTemplate;
-use Mall\Framework\Core\StatusCode;
-use Mall\Framework\Factory;
-
-/**
- * 获取小程序审核状态
- * Class GetWxAuditStatus
- * @package JinDouYun\Controller\Cron
- */
-class GetWxAuditStatus
-{
-    private $oplatformConfigData;
-
-    private $objDEnterpriseBindTemplate;
-
-    public function __construct()
-    {
-        echo date('Y-m-d H:i:s') . ': S-获取小程序审核状态' . PHP_EOL;
-        $this->objDEnterpriseBindTemplate = new DEnterpriseBindTemplate();
-        $oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            exit('配置错误');
-        }
-        $this->oplatformConfigData = $oplatformConfigData;
-    }
-
-    public function pullWxAuditStatus()
-    {
-        //获取正在审核中小程序的审核状态
-        $dbResult = $this->objDEnterpriseBindTemplate->select(['enableStatus' => StatusCode::$standard, 'auditStatus' => StatusCode::$wxAuditStatus['inAudit']]);
-        if ($dbResult === false) {
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . '查询审核中模版失败: ' . var_export($this->objDEnterpriseBindTemplate->error(), true) . PHP_EOL, FILE_APPEND);
-            die;
-        }
-        if (empty($dbResult)) {
-            file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . '暂时没有审核中的模版' . PHP_EOL, FILE_APPEND);
-            die;
-        }
-
-        foreach ($dbResult as $value) {
-            $objMEnterpriseBindTemplate = new MEnterpriseBindTemplate(null, $value['enterpriseId']);
-            $dbResult = $objMEnterpriseBindTemplate->getAuditStatus([
-                'templateId'   => $value['templateId'],
-                'enterpriseId' => $value['enterpriseId'],
-                'auditId'      => $value['auditId'],
-            ]);
-            if (!$dbResult->isSuccess()){
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . '查询审核状态失败: ' . var_export($dbResult->getData(), true) . PHP_EOL, FILE_APPEND);
-                continue;
-            }
-        }
-    }
-
-    public function __destruct()
-    {
-        echo date('Y-m-d H:i:s') . ': E-获取小程序审核状态' . PHP_EOL;
-        // TODO: Implement __destruct() method.
-    }
-}

+ 0 - 54
Controller/Cron/NewCommissionCron.Class.php

@@ -1,54 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/16
- * Time: 9:41
- */
-
-namespace JinDouYun\Controller\Cron;
-
-
-use JinDouYun\Dao\Enterprise\DEnterprise;
-use Util\Common\PartnerTools;
-use Util\Common\AgentTools;
-use JinDouYun\Model\Market\MCoupon;
-use Mall\Framework\Core\StatusCode;
-
-class NewCommissionCron
-{
-    //命令:php /www/wwwroot/apiqnys.liuniukj.com/Public/www/index.php -mCron -cNewCommissionCron -anewCommissionTask >> /www/wwwroot/logs/apiqnys.liuniukj.com/cron.log 2>&1 &
-    
-    public function newCommissionTask(){
-        echo PHP_EOL."新佣金计算任务开始".PHP_EOL;
-        $objDEnterprise = new DEnterprise();
-        $objDEnterprise->setTable('qianniao_enterprise_1');
-        $enterpriseList = $objDEnterprise->select(['deleteStatus' => StatusCode::$standard]);
-        if (empty($enterpriseList)){
-            echo '企业数据为空'.PHP_EOL;
-            die;
-        }
-        foreach ($enterpriseList as $value){
-            if(empty($value['id'])) continue;
-            
-            //合伙人任务
-            $taskTotal = new PartnerTools($value['id']);
-            $res = $taskTotal->runTask();
-            if(empty($res) || empty($res["code"])){
-                echo '系统错误'.PHP_EOL;
-            }else{
-                echo json_encode($res,JSON_UNESCAPED_UNICODE).PHP_EOL;
-            }
-            
-            //门店代理任务
-            $taskTotal2 = new AgentTools($value['id']);
-            $res2 = $taskTotal2->runTaskNew();
-            if(empty($res2) || empty($res2["code"])){
-                echo '系统错误'.PHP_EOL;
-            }else{
-                echo json_encode($res2,JSON_UNESCAPED_UNICODE).PHP_EOL;
-            }
-        }
-        echo '新佣金计算任务结束'.PHP_EOL;
-    }
-}

+ 0 - 314
Controller/Cron/OrderCron.Class.php

@@ -1,314 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Cron;
-
-use JinDouYun\Controller\Common\Logger;
-use JinDouYun\Dao\Enterprise\DEnterprise;
-use JinDouYun\Dao\Order\DOrder;
-use JinDouYun\Dao\Order\DOrderIndex;
-use JinDouYun\Model\Stock\MInventory;
-use Mall\Framework\Core\StatusCode;
-
-/**
- * 订单
- * 基本设置增加配置:
- * orderAutoCloseSec (货到付款的订单未审核,自动取消订单的时间节点 单位:秒)
- * orderAutoFinishSec (订单出库后用户未确认收货. 自动收货节点 单位:秒)
- * Class OrderCron
- * @package JinDouYun\Controller\Cron
- */
-class OrderCron
-{
-    /**
-     * 切割数量
-     * @var int
-     */
-    private $cutTable = 200000;
-
-    /**
-     * 企业列表
-     * @var array|null
-     */
-    private $enterprises = null;
-
-    /**
-     * 当前时间戳
-     * @var int
-     */
-    private $nowTime;
-
-    /**
-     * @var DOrderIndex
-     */
-    private $objDOrderIndex;
-
-    /**
-     * @var DOrder
-     */
-    private $objDOrder;
-
-    /**
-     * OrderCron constructor.
-     * @throws \Exception
-     */
-    public function __construct()
-    {
-        echo date('Y-m-d H:i:s') . ':订单定时任务执行开始' . PHP_EOL;
-        $this->nowTime = time();
-        $this->objDOrderIndex = new DOrderIndex();
-        $this->objDOrder = new DOrder();
-        $this->objDOrder->setSearchIndex('order_search')->setType('order');
-
-        //获取企业
-        $fields = "e.id,e.enterpriseName,b.basicData";
-        $sql = 'SELECT ' . $fields . ' FROM qianniao_enterprise_1 as e 
-                LEFT JOIN qianniao_basic_setup as b ON e.id=b.enterpriseId 
-                WHERE b.id IS NOT NULL';
-
-        $objDEnterprise = new DEnterprise();
-        $enterprises = $objDEnterprise->query($sql);
-        if ($enterprises === false) {
-            die('查询企业列表失败');
-        }
-
-        foreach ($enterprises as $val){
-            $json = json_decode($val['basicData'],true);
-            $this->enterprises[] = [
-                'enterpriseId' => $val['id'],
-                'enterpriseName' => $val['enterpriseName'],
-                'orderAutoCloseSec' => isset($json['orderAutoCloseSec']) ? $json['orderAutoCloseSec'] : null,  //自动取消订单设置
-                'orderAutoFinishSec' => isset($json['orderAutoFinishSec']) ? $json['orderAutoFinishSec'] : null, //自动收货订单设置
-            ];
-        }
-
-        if (empty($this->enterprises)) {
-            die('没有企业订单数据待处理');
-        }
-    }
-
-    /**
-     * 自动关闭订单
-     * condition 订单创建时间 < 当前时间戳-自动关闭时间秒, payType = 3, auditStatus=1, payStatus=4,orderStatus != 6
-     * @throws \Exception
-     */
-    public function autoClose()
-    {
-        
-        $field = 'id,userCenterId';
-        foreach ($this->enterprises as $item) {
-            //检查企业是否配置订单未支付自动关闭
-            if (empty((int) $item['orderAutoCloseSec'])) {
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . $item['enterpriseName'] . '未配置订单自动关闭时间,不进行处理' . PHP_EOL, FILE_APPEND);
-                echo $item['enterpriseName'].'未配置自动取消时间'.PHP_EOL;
-                continue;
-            }
-            //检查过期时间
-            $expire = $this->nowTime - $item['orderAutoCloseSec'];
-            
-            $sql = 'SELECT  ' . $field . ' FROM qianniao_order_index_' . $item['enterpriseId'] . ' 
-                    WHERE createTime>1593446400 AND 
-                    auditStatus=' . StatusCode::$auditStatus['auditing'] . ' AND 
-                    payStatus=' . StatusCode::$delete . ' AND 
-                    orderStatus!=' . StatusCode::$orderStatus['close'] . ' AND 
-                    createTime < ' . $expire;
-            //查询数据
-            // 根据索引表查询订单索引数据
-            $orderList = $this->objDOrderIndex->query($sql);
-            if ($orderList === false) {
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . $item['enterpriseName'] . '查询订单时出错' . $this->objDOrderIndex->error() . PHP_EOL, FILE_APPEND);
-                echo '查询订单时出错'.$this->objDOrderIndex->error().PHP_EOL;
-                continue;
-            }
-
-            //没有数据
-            if (empty($orderList)) {
-                echo $item['enterpriseName'] . '-没有需要处理的订单' . PHP_EOL;
-                continue;
-            }
-
-            
-            $count = count((array)$orderList);
-
-            //处理数据,计算表后缀
-            $allGroupOrder = [];
-            foreach ($orderList as $value) {
-                $tableNum = ceil($value['userCenterId'] / $this->cutTable);
-                $allGroupOrder[$tableNum][] = $value['id'];
-            }
-
-            //更新操作
-            $this->objDOrderIndex->beginTransaction();
-            //更新订单表
-            foreach ($allGroupOrder as $fix => $row) {
-                //切换订单分表
-                $this->objDOrder->setTable('qianniao_order_' . $item['enterpriseId'] . '_' . $fix);
-                //更新数据
-                //根据订单编号修改订单数据
-                $orderUpdate = $this->objDOrder->update(
-                    [
-                        'orderStatus' => StatusCode::$orderStatus['close'],
-                        'updateTime'  => $this->nowTime
-                    ],
-                    ['id' => $row]
-                );
-                if ($orderUpdate === false) {
-                    file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . $item['enterpriseName'] . 'update订单时出错' . $this->objDOrder->error() . PHP_EOL, FILE_APPEND);
-                    $this->objDOrderIndex->rollBack();
-                    die('更新订单时出错');
-                }
-
-                //解锁库存
-                $objMInventory = new MInventory($item['enterpriseId'], '');
-                $unlockResult = $objMInventory->unlockInventory($row, StatusCode::$orderType['saleOrder'], $this->nowTime);
-                if (!$unlockResult->isSuccess()) {
-                    file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . $item['enterpriseName'] . '解锁库存时出错' . $unlockResult->getData() . PHP_EOL, FILE_APPEND);
-                    $this->objDOrderIndex->rollBack();
-                    die('关闭订单时解锁库存失败');
-                }
-            }
-
-            //更新订单索引表
-            $this->objDOrderIndex->setTable('qianniao_order_index_' . $item['enterpriseId']);
-            $orderIndexUpdate = $this->objDOrderIndex->update(
-                [
-                    'orderStatus' => StatusCode::$orderStatus['close'],
-                    'updateTime'  => $this->nowTime
-                ],
-                [
-                    'id' => array_values(array_column((array)$orderList, 'id'))
-                ]
-            );
-
-            if ($orderIndexUpdate === false) {
-                file_put_contents('/www/wwwroot/logs/apiqnys.liuniukj.com/cron.log', date('Y-m-d H:i:s') . $item['enterpriseName'] . '解锁库存时出错' . $this->objDOrderIndex->error() . PHP_EOL, FILE_APPEND);
-                $this->objDOrderIndex->rollBack();
-                die('更新订单索引表时出错');
-            }
-
-            echo date('Y-m-d H:i:s') . 'SUCCESS:' . $item['enterpriseName'] . '处理成功,共处理' . $count . '条数据' . PHP_EOL;
-
-            $this->objDOrderIndex->commit();
-//            //在ES更新订单状态
-//            foreach ($orderList as $list) {
-//                $_id = self::createEsDocumentId($list['id'], $item['enterpriseId']);
-//                $this->objDOrder->esupdateTypeFieldVaule(['orderStatus' => StatusCode::$orderStatus['close']], $_id);
-//            }
-
-        }
-    }
-
-    /**
-     * 自动完成订单
-     * 订单出库后用户未确认收货. 自动收货
-     *
-     * @throws \Exception
-     */
-    public function autoFinish()
-    {
-        $field = 'id,userCenterId';
-
-        foreach ($this->enterprises as $item) {
-            //检查企业是否配置订单自动完成
-            if (empty((int)$item['orderAutoFinishSec'])) {
-                echo $item['enterpriseName'].'未配置自动收货时间'.PHP_EOL;
-                continue;
-            }
-            $expire = $this->nowTime - $item['orderAutoFinishSec'];
-            $sql = 'SELECT ' . $field . ' FROM qianniao_order_index_' . $item['enterpriseId'] . '
-                    WHERE createTime>1620907760 AND 
-                    outStatus=' . StatusCode::$standard . ' AND 
-                    (orderStatus !=' . StatusCode::$orderStatus['finish'] . ' or isRet = '.StatusCode::$standard.') AND 
-                    outTime < ' . $expire;
-
-            //查询数据
-            $orderList = $this->objDOrderIndex->query($sql);
-            if ($orderList === false) {
-                echo '查询订单时出错'.$this->objDOrderIndex->error().PHP_EOL;
-                continue;
-            }
-
-            //没有数据
-            if (empty($orderList)) {
-                echo $item['enterpriseName'] . '-没有需要处理的订单' . PHP_EOL;
-                continue;
-            }
-
-            $count = count((array)$orderList);
-
-            //处理数据,计算表后缀
-            $allGroupOrder = [];
-            foreach ($orderList as $value) {
-                $tableNum = ceil($value['userCenterId'] / $this->cutTable);
-                $allGroupOrder[$tableNum][] = $value['id'];
-            }
-
-            //更新操作
-            $this->objDOrderIndex->beginTransaction();
-            //更新订单表
-            foreach ($allGroupOrder as $fix => $row) {
-                //切换订单分表
-                $this->objDOrder->setTable('qianniao_order_' . $item['enterpriseId'] . '_' . $fix);
-                //更新数据
-                $orderUpdate = $this->objDOrder->update(
-                    [
-                        'orderStatus'      => StatusCode::$orderStatus['finish'],
-                        'updateTime'       => $this->nowTime,
-                        'successFullyTime' => $this->nowTime
-                    ],
-                    ['id' => $row]
-                );
-                if ($orderUpdate === false) {
-                     echo $item['enterpriseName'] . 'update订单时出错' . $this->objDOrder->error() . PHP_EOL;
-                    $this->objDOrderIndex->rollBack();
-                    die('更新订单时出错');
-                }
-            }
-
-            $this->objDOrderIndex->setTable('qianniao_order_index_' . $item['enterpriseId']);
-            $orderIndexUpdate = $this->objDOrderIndex->update(
-                [
-                    'orderStatus'      => StatusCode::$orderStatus['finish'],
-                    'updateTime'       => $this->nowTime
-                ],
-                [
-                    'id' => array_values(array_column((array)$orderList, 'id'))
-                ]
-            );
-
-            if ($orderIndexUpdate === false) {
-                echo $item['enterpriseName'] . '解锁库存时出错' . $this->objDOrderIndex->error() . PHP_EOL;
-                $this->objDOrderIndex->rollBack();
-                die('更新订单索引表时出错');
-            }
-
-            echo date('Y-m-d H:i:s') . 'autoFinish-SUCCESS:' . $item['enterpriseName'] . '处理成功,共处理' . $count . '条数据' . PHP_EOL;
-
-            $this->objDOrderIndex->commit();
-            //在ES更新订单审核状态
-            /*foreach ($orderList as $list) {
-                $_id = self::createEsDocumentId($list['orderId'], $item['enterpriseId']);
-                $this->objDOrder->esupdateTypeFieldVaule(['orderStatus' => StatusCode::$orderStatus['finish']], $_id);
-            }*/
-
-        }
-    }
-
-    /**
-     * 创建文档id
-     * @param $orderIndexId
-     * @param $enterpriseId
-     * @return string
-     */
-    private function createEsDocumentId(int $orderIndexId, int $enterpriseId)
-    {
-        return 'EnterpriseId_' . $enterpriseId . '_OrderIndexId_' . $orderIndexId;
-    }
-
-
-    public function __destruct()
-    {
-        // TODO: Implement __destruct() method.
-        echo date('Y-m-d H:i:s') . ':订单定时任务执行结束' . PHP_EOL;
-    }
-}

+ 0 - 79
Controller/Cron/PriceCron.Class.php

@@ -1,79 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Cron;
-
-use JinDouYun\Dao\Price\DNationalUnifiedPrice;
-use JinDouYun\Dao\Price\DPriceRangeSheet;
-
-/**
- * 同步价格数据到最高/低价格表
- * Class PriceCron
- * @package JinDouYun\Controller\Cron
- */
-class PriceCron
-{
-    public function __construct()
-    {
-        echo date('Y-m-d H:i:s') . ':同步价格数据开始' . PHP_EOL;
-    }
-
-    /**
-     * @throws \Exception
-     */
-    public function syncRangePrice()
-    {
-
-        $enterpriseIds = [1,3,4,10,11,13,15,16];//dev
-        //$enterpriseIds = [1,4,7,8,9,13,14,17,18,19,21,23,24,25,27];//master
-        $objDNationalUnifiedPrice = new DNationalUnifiedPrice();
-        $objDPriceRangeSheet = new DPriceRangeSheet();
-        foreach ($enterpriseIds as $enterpriseId){
-            // 按照企业分表
-            $tableName = 'qianniao_nationalUnifiedPrice_' . $enterpriseId;
-            $objDNationalUnifiedPrice->setTable($tableName);
-
-            $dbResult = $objDNationalUnifiedPrice->select([],'goodsId,shopId,salePrice');
-            if ($dbResult === false){
-                echo '获取'.$enterpriseId.'企业价格表数据失败'.$objDNationalUnifiedPrice->error().PHP_EOL;
-                exit;
-            }
-            if (empty($dbResult)){
-                echo '企业'.$enterpriseId.'价格表数据为空不需要同步'.PHP_EOL;
-                continue;
-            }
-
-            // 按照企业分表
-            $objDPriceRangeSheet->setTable('qianniao_priceRangeSheet_'.$enterpriseId);
-            $add = [];
-            foreach ($dbResult as $row){
-                $salePrice = json_decode($row['salePrice'],true);
-                $allSalePrice = array_column($salePrice,'salePrice');
-                $sale = [
-                    'minSalePrice' => min($allSalePrice),
-                    'maxSalePrice' => max($allSalePrice),
-                ];
-                $add[] = [
-                    'goodsCode'  => isset($row['goodsCode']) ? $row['goodsCode'] : '',
-                    'goodsName'  => isset($row['goodsName']) ? $row['goodsName'] : '',
-                    'goodsId'    => $row['goodsId'],
-                    'shopId'     => $row['shopId'],
-                    'createTime' => time(),
-                    'salePrice'  => json_encode($sale),
-                ];
-            }
-            $result = $objDPriceRangeSheet->replace($add,true);
-            if ($result === false){
-                echo '企业'.$enterpriseId.'写入最低/高表价格失败'.$objDPriceRangeSheet->error().PHP_EOL;
-                exit;
-            }
-
-            echo '企业'.$enterpriseId.'写入最低/高价格表成功,共写入'.count($add).'条数据'.PHP_EOL;
-        }
-    }
-
-    public function __destruct()
-    {
-        echo date('Y-m-d H:i:s') . ':同步价格数据完成' . PHP_EOL;
-    }
-}

+ 0 - 106
Controller/Cron/PullWxInfo.Class.php

@@ -1,106 +0,0 @@
-<?php
-/**
- * 每分钟执行一次,拉取已授权账号信息,将要过期的信息,刷新
- * authorizer_access_token 有效期为 2 小时
- * 1.获取已授权账号信息
- * 2.若授权即将过期,调用刷新令牌接口,重新获取令牌
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2020/4/20
- * Time: 14:11
- */
-
-namespace JinDouYun\Controller\Cron;
-
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Factory;
-
-use JinDouYun\Dao\Oem\DOem;
-
-use Util\WeiXin\Oplatform;
-
-class PullWxInfo
-{
-    private $oplatformConfigData;
-
-    public function __construct()
-    {
-        echo date('Y-m-d H:i:s') . ':拉取已授权账号信息' . PHP_EOL;
-        /*$oplatformConfigData = Factory::config()->getAppoint('weixin', 'oplatform');
-        if (empty($oplatformConfigData)) {
-            exit('配置错误');
-        }
-        $this->oplatformConfigData = $oplatformConfigData;*/
-    }
-
-    /**
-     * 对所有代理的微信开发平台授权自行自动更新操作
-     */
-    public function autoAuthorizerToken()
-    {
-        $objDOem = new DOem();
-        $dbResult = $objDOem->select(' weixinOpenAppid != ""', 'weixinOpen', 'id asc');
-        if( $dbResult === false ){
-            echo $dbResult->error();exit();
-        }
-
-        if( empty($dbResult) ){
-            echo '没有微信开放平台需要刷新';exit();
-        }
-
-        foreach ($dbResult as $key => $value){
-            $this->oplatformConfigData = json_decode($value['weixinOpen'], true);
-            self::pullWx();
-        }
-    }
-
-    /**
-     * 拉取已授权用户信息,效验过期时间
-     * @throws \Exception
-     */
-    public function pullWx()
-    {
-        $objOplatform = new Oplatform($this->oplatformConfigData['appid'], $this->oplatformConfigData['token'], $this->oplatformConfigData['encodingAesKey'], $this->oplatformConfigData['appSecret']);
-        $pullResult = $objOplatform->apiGetAuthorizerList();
-        if (!$pullResult->isSuccess()) {
-            echo $pullResult->getData();
-        }
-        $userData = $pullResult->getData();
-        if (empty($userData)) {
-            echo '拉取已经授权用户信息为空';
-        }
-        if (!isset($userData['list']) || empty($userData['list'])) {
-            echo '拉取已经授权用户信息为空';
-        }
-        $time = time();
-        foreach ($userData['list'] as $val) {
-            //获取上次刷新的时间
-            $expire = Factory::cache('default')->hget('appid_expire', $val['authorizer_appid']);//上次刷新的时间
-            if ((($expire + 6480) < $time) || empty($expire)) {
-                //已过期,刷新token
-                $result = self::refAuth($val);
-                if ($result->isSuccess()) {
-                    Factory::cache('default')->hset('appid_expire', $val['authorizer_appid'], $time);//本次刷新的时间
-                    echo $val['authorizer_appid'] . '刷新令牌成功'.PHP_EOL;
-                } else {
-                    echo $val['authorizer_appid'] . '刷新令牌失败' . $result->getData().PHP_EOL;
-                }
-            }
-        }
-    }
-
-    /**
-     * 刷新令牌
-     * @param $params
-     * @return ResultWrapper
-     */
-    private function refAuth($params)
-    {
-        $objOplatform = new Oplatform($this->oplatformConfigData['appid'], $this->oplatformConfigData['token'], $this->oplatformConfigData['encodingAesKey'], $this->oplatformConfigData['appSecret']);
-        $result = $objOplatform->apiAuthorizerToken($params['authorizer_appid'], $params['refresh_token']);
-        if (!$result->isSuccess()) {
-            return ResultWrapper::fail($result->getData(), $result->getErrorCode());
-        }
-        return ResultWrapper::success($result->getData());
-    }
-}

+ 0 - 213
Controller/Cron/SupplierPurchaseCron.Class.php

@@ -1,213 +0,0 @@
-<?php
-
-
-namespace JinDouYun\Controller\Cron;
-
-
-use JinDouYun\Dao\Department\DStaff;
-use JinDouYun\Dao\Enterprise\DEnterprise;
-use JinDouYun\Dao\Order\DSupplierOrderDetails;
-use JinDouYun\Dao\Order\DSupplierOrderIndex;
-use JinDouYun\Model\Order\MSupplierOrderDetails;
-use JinDouYun\Model\Order\TStdOrder;
-use JinDouYun\Model\Purchase\MPurchase;
-use JinDouYun\Model\System\MBasicSetup;
-use Mall\Framework\Core\StatusCode;
-
-class SupplierPurchaseCron
-{
-    use Cron;
-
-    private $enterprises = [];
-
-    use TStdOrder;
-
-
-    public function __construct()
-    {
-        self::sendOutput('start-创建采购单');
-    }
-
-    public function __destruct()
-    {
-        // TODO: Implement __destruct() method.
-        self::sendOutput('end-创建采购单');
-    }
-
-    /**
-     * Doc: (des="")
-     * User: XMing
-     * Date: 2020/12/24
-     * Time: 2:13 下午
-     */
-    public function getEnterprise()
-    {
-        //获取企业
-        $time = time();
-        $fault = 120;
-        $fields = "e.id,e.enterpriseName,b.basicData";
-        $sql = 'SELECT ' . $fields . ' FROM qianniao_enterprise_1 as e 
-                LEFT JOIN qianniao_basic_setup as b ON e.id=b.enterpriseId 
-                WHERE b.id IS NOT NULL';
-
-        $objDEnterprise = new DEnterprise();
-        $enterprises = $objDEnterprise->query($sql);
-        if ($enterprises === false) {
-            self::sendOutput('sql错误', $objDEnterprise->error(), true);
-        }
-
-        foreach ($enterprises as $val) {
-            $json = json_decode($val['basicData'], true);
-            $supplierSet = getArrayItem($json, 'supplierSet', []);
-
-            $auto_ctime = getArrayItem($supplierSet, 'auto_ctime', 0);
-            if (empty($auto_ctime)) {
-                continue;
-            }
-            $auto_ctime = self::todayTime($auto_ctime);
-            //测试的时候注释
-            if (!($time - $auto_ctime > 0 && $time - $auto_ctime < $fault)) {
-                continue;
-            }
-
-            $this->enterprises[] = [
-                'enterpriseId'   => $val['id'],
-                'enterpriseName' => $val['enterpriseName'],
-                'auto_ctime'     => getArrayItem($supplierSet, 'auto_ctime', 0),
-                'enable_istrue'  => getArrayItem($supplierSet, 'enable_istrue', StatusCode::$delete),
-            ];
-        }
-
-        if (empty($this->enterprises)) {
-            self::sendOutput('data null', '没有企业数据', true);
-        }
-    }
-
-    /**
-     * Doc: (des="将任意某天的时间戳转化为对应今日的时间戳,保留时分秒")
-     * User: XMing
-     * Date: 2020/12/24
-     * Time: 10:49 上午
-     * @param $ctime
-     */
-    function todayTime($ctime)
-    {
-        $arr = explode(':', $ctime);
-        return mktime(
-            getArrayItem($arr, 0, 1),
-            getArrayItem($arr, 1, 0),
-            getArrayItem($arr, 2, 0)
-        );
-    }
-
-
-    /**
-     * Doc: (des=)
-     * User: XMing
-     * Date: 2020/12/23
-     * Time: 10:58 上午
-     * @throws \Exception
-     */
-    public function create()
-    {
-        self::getEnterprise();
-        $beginYesterday = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
-        $endYesterday = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
-        $objDSupplierOrderIndex = new DSupplierOrderIndex();
-        $objDSupplierOrderDetails = new DSupplierOrderDetails();
-        foreach ($this->enterprises as $item) {
-            $enterpriseId = getArrayItem($item, 'enterpriseId', 0);
-            if (empty($enterpriseId)) {
-                continue;
-            }
-            $objMPurchase = new MPurchase('', $enterpriseId);
-            $objMSupplierOrderDetails = new MSupplierOrderDetails($enterpriseId, '');
-            $objDSupplierOrderIndex->setTable('qianniao_supplier_order_index_' . $enterpriseId);
-
-
-            $objDStaff = new DStaff();
-            $objDStaff->setTable('qianniao_staff_'.$enterpriseId);
-            $staff = $objDStaff->get(['departmentId' => 1],'userCenterId,staffName,departmentId');
-            if ($staff === false){
-                self::sendOutput('sql error', $objDStaff->error());
-            }
-
-            $fields = ' o.id as orderId,s.* ';
-            /*$sql = 'SELECT ' . $fields . ' FROM qianniao_supplier_order_index_' . $enterpriseId . ' AS s
-                    LEFT JOIN qianniao_order_index_' . $enterpriseId . ' AS o 
-                    ON o.id = s.orderId WHERE s.purchaseStatus = ' . StatusCode::$delete . ' 
-                    AND o.auditStatus = ' . StatusCode::$auditStatus['auditPass'] . ' 
-                    AND s.createTime BETWEEN ' . $beginYesterday . ' AND ' . $endYesterday;*/
-
-            $sql = 'SELECT ' . $fields . ' FROM qianniao_supplier_order_index_' . $enterpriseId . ' AS s 
-                    LEFT JOIN qianniao_order_index_' . $enterpriseId . ' AS o 
-                    ON o.id = s.orderId WHERE s.purchaseStatus = ' . StatusCode::$delete . ' 
-                    AND o.auditStatus = ' . StatusCode::$auditStatus['auditPass'];//TODO(测试的时候用这个sql)
-            $indexLists = $objDSupplierOrderIndex->query($sql);
-            if ($indexLists === false) {
-                self::sendOutput('sql error', $objDSupplierOrderIndex->error());
-                continue;
-            }
-            if (empty($indexLists)) {
-                continue;
-            }
-            $allGroupData = [];
-            $detailsData = [];
-            $ids = [];
-            foreach ($indexLists as $list) {
-                $tableNum = ceil($list['orderId'] / MSupplierOrderDetails::$cutTable);
-                $allGroupData[$tableNum][] = $list['id'];
-                $ids[] = $list['id'];
-            }
-            foreach ($allGroupData as $k => $ids) {
-                $objDSupplierOrderDetails->setTable('qianniao_supplier_order_details_' . $enterpriseId . '_' . $k);
-                $dbResult = $objDSupplierOrderDetails->select(['id' => $ids]);
-                if ($dbResult === false) {
-                    self::sendOutput('sql error', $objDSupplierOrderDetails->error());
-                    continue;
-                }
-                $detailsData = array_merge($dbResult, $detailsData);
-            }
-            //将数据按照供应商分组
-            $supplierDetailsGroupData = [];
-            $supplierMap = [];
-            foreach ($detailsData as $datum) {
-                $supplierDetailsGroupData[$datum['supplierId']][] = $datum;
-                $supplierMap[$datum['supplierId']] = [
-                    'shopId'       => $datum['shopId'],
-                    'shopName'     => $datum['shopName'],
-                    'supplierId'   => $datum['supplierId'],
-                    'supplierName' => $datum['supplierName']
-                ];
-            }
-
-            foreach ($supplierMap as $supplierId => $common) {
-                $lists = getArrayItem($supplierDetailsGroupData, $supplierId, []);
-                if (empty($lists)) {
-                    self::sendOutput('data is empty', '');
-                    continue;
-                }
-
-                $common['operatorId'] = getArrayItem($staff,'userCenterId',0);
-                $common['operatorName'] = getArrayItem($staff,'staffName','');
-                $common['buyerId'] = getArrayItem($staff,'userCenterId',0);
-                $common['buyerName'] = getArrayItem($staff,'staffName','');
-                $common['departmentPath'] = getArrayItem($staff,'departmentId','');
-                $buildInsert = self::buildPurchase($common, $lists);
-                print_r($buildInsert);
-                $result = $objMPurchase->addPurchase($buildInsert);
-                if (!$result->isSuccess()) {
-                    self::sendOutput('sql error', $result->getData());
-                    continue;
-                }
-            }
-            $updateResult = $objMSupplierOrderDetails->updatePurchaseStatus($ids);
-            if (!$updateResult->isSuccess()) {
-                self::sendOutput('sql error', $updateResult->getData());
-                continue;
-            }
-            self::sendOutput('success', '创建采购单成功');
-        }
-    }
-
-}

+ 0 - 576
Controller/Customer/ApiCustomer.Class.php

@@ -1,576 +0,0 @@
-<?php
-/**
- * 获取当前登录的客户信息
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/11/20
- * Time: 19:24
- */
-
-namespace JinDouYun\Controller\Customer;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use Jindouyun\Cache\CustomerCache;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Customer\MCustomer;
-use JinDouYun\Model\System\MCustomerSource;
-use JinDouYun\Model\Goods\MGoodsCollect;
-use JinDouYun\Model\Customer\MCustomerDemand;
-use JinDouYun\Model\Customer\MCustomerVisitsLog;
-use JinDouYun\Model\Customer\MMemberBalanceDetail;
-use JinDouYun\Model\Customer\MReflectDetail;
-use JinDouYun\Model\Finance\MCustomerBalanceDetail;
-use JinDouYun\Dao\SysAreaChina\DSysAreaChina;
-use Util\Common\AgentTools;
-
-class ApiCustomer extends BaseController
-{
-    private $objMCustomer;
-    private $objMCustomerSource;
-    private $objMGoodsCollect;
-    private $objMCustomerDemand;
-    private $objMCustomerVisitsLog;
-    private $objMMemberBalanceDetail;
-    private $objMReflectDetail;
-    private $objMCustomerBalanceDetail;
-    private $agentTool;
-    private $customerData;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
-        $this->objMCustomer = new MCustomer($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMCustomerSource = new MCustomerSource($this->onlineEnterpriseId);
-        $this->objMGoodsCollect = new MGoodsCollect($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMCustomerDemand = new MCustomerDemand($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMCustomerVisitsLog = new MCustomerVisitsLog($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMMemberBalanceDetail = new MMemberBalanceDetail($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMReflectDetail = new MReflectDetail($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMCustomerBalanceDetail = new MCustomerBalanceDetail($this->onlineEnterpriseId, $this->onlineUserId);
-        
-        
-        $this->agentTool = new AgentTools($this->onlineEnterpriseId);
-//        $this->customerData = $this->agentTool->getCustomerDataByUserCenterId($this->onlineUserId);
-    }
-
-    /**
-     * 添加和编辑客户管理公共字段处理方法
-     *
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $customerData = [
-            'name' => isset($params['name']) ? $params['name'] : '',
-            'contact' => isset($params['contact']) ? $params['contact'] : '',
-            'provinceCode' => isset($params['provinceCode']) ? $params['provinceCode'] : '',
-            'cityCode' => isset($params['cityCode']) ? $params['cityCode'] : '',
-            'districtCode' => isset($params['districtCode']) ? $params['districtCode'] : '',
-        ];
-
-        foreach ($customerData as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $customerData['type'] = isset($params['type']) ? $params['type'] : '';
-        $customerData['recommenderType'] = isset($params['recommenderType']) ? $params['recommenderType'] : '';
-        $customerData['recommenderId'] = isset($params['recommenderId']) ? $params['recommenderId'] : '';
-        $customerData['longitude'] = isset($params['longitude']) ? $params['longitude'] : 0;//经度
-        $customerData['latitude'] = isset($params['latitude']) ? $params['latitude'] : 0;//纬度
-        $customerData['avatar'] = isset($params['avatar']) ? $params['avatar'] : '';
-        $customerData['birthday'] = isset($params['birthday']) ? $params['birthday'] : '';
-        $customerData['remark'] = isset($params['remark']) ? $params['remark'] : '';
-        $customerData['extend'] = isset($params['extend']) ? json_encode($params['extend']) : '';
-        $customerData['address'] = getArrayItem($params, 'address', '');
-        $customerData['updateTime'] = time();
-        return $customerData;
-    }
-
-    /**
-     * 修改当前客户信息
-     */
-    public function editCustomerInfo()
-    {
-        $customerData = $this->commonFieldFilter();
-        $customerData['userCenterId'] = $this->onlineUserId;
-        $result = $this->objMCustomer->editCustomerInfo($customerData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-
-    /**
-     * 获取当前的客户信息
-     */
-    public function getCustomerInfo()
-    {
-        $customerData = $this->objMCustomer->getCustomerInfoByUserCenterId($this->onlineUserId, true);
-        if ($customerData->isSuccess()) {
-            $customerInfo = $customerData->getData();
-            
-            $agentData = $this->agentTool->getAndSetAgentData($customerInfo["id"]);
-            $customerInfo["agentId"] = empty($agentData) ? 0 : $agentData["id"];
-
-            $this->sendOutput($customerInfo);
-        } else {
-            $this->sendOutput($customerData->getData(), ErrorCode::$contentNotExists);
-        }
-    }
-
-    /**
-     * 完善资料获取客户类型
-     */
-    public function getCustomerSourceList()
-    {
-        $result = $this->objMCustomerSource->getCustomerSourceList();
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            parent::sendOutput($returnData);
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 收藏商品
-     * @throws Exception
-     */
-    public function collect()
-    {
-        $goodsId = $this->request->param('request_id');
-        if (!$goodsId) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMGoodsCollect->addGoodsCollect($goodsId);
-        if ($result->isSuccess()) {
-            $this->sendOutput($result->getData());
-        }
-
-        $this->sendOutput($result->getData(), $result->getErrorCode());
-    }
-
-    /**
-     * 充值余额
-     * @throws Exception
-     */
-    public function rechargeBalance()
-    {
-        $params = $this->request->getRawJson();
-        $data['money'] = isset($params['money']) ? $params['money'] : '';
-        foreach ($data as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $data['userCenterId'] = $this->onlineUserId;
-        $data['id'] = $this->request->get_onlineip();
-        $result = $this->objMCustomer->rechargeBalance($data);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 充值记录列表
-     */
-    public function getAllRechargeBalance()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $selectParams['shopId'] = isset($params['shopId']) ? $params['shopId'] : '';
-        foreach ($selectParams as $key => $value) {
-            if (empty($value)) {
-                parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $params['page'] = isset($params['page']) ? $params['page'] : 1;
-        $params['pageSize'] = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $selectParams['userCenterId'] = $this->onlineUserId;
-
-        $modelResult = $this->objMCustomer->getAllRechargeBalance($selectParams);
-        if (!$modelResult->isSuccess()) {
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 添加客户需求
-     */
-    public function addCustomerdemand()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $demandData = [
-            'enterpriseId' => $this->onlineEnterpriseId,
-            'customerId' => getArrayItem($params, 'customerId'),
-            'demand' => getArrayItem($params, 'demand'),
-        ];
-        $demandData['updateTime'] = time();
-        $result = $this->objMCustomerDemand->addCustomerdemand($demandData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 添加客户访问记录
-     */
-    public function addCustomerVisitsLog()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $visitsLogData = [
-            'usercenterid' => getArrayItem($params, 'usercenterid'),
-            'customerid' => getArrayItem($params, 'customerid'),
-            'shopid' => getArrayItem($params, 'shopid'),
-            'goodsid' => getArrayItem($params, 'goodsid'),
-        ];
-        $visitsLogData['updateTime'] = time();
-        $result = $this->objMCustomerVisitsLog->addCustomerVisitsLog($visitsLogData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 添加余额支付密码
-     */
-    public function addpayPassword()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $payPasswordData = [
-            'enterpriseId' => $this->onlineEnterpriseId,
-            'id' => getArrayItem($params, 'id'),
-            'payPassword' => getArrayItem($params, 'payPassword'),
-        ];
-        foreach ($payPasswordData as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $payPasswordData['updateTime'] = time();
-        //密码格式化;
-        $payPasswordData['payPassword'] = password_hash($payPasswordData['payPassword'], PASSWORD_DEFAULT);
-        $result = $this->objMCustomer->addpayPassword($payPasswordData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 修改余额支付密码
-     */
-    public function updatePayPassword()
-    {
-        $params = $this->request->getRawJson();
-        if (!$params) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $updatePayPasswordData = [
-            'enterpriseId' => $this->onlineEnterpriseId,
-            'id' => getArrayItem($params, 'id'),
-            'payPassword' => trim(getArrayItem($params, 'payPassword')),
-        ];
-        foreach ($updatePayPasswordData as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $updatePayPasswordData['updateTime'] = time();
-        $updatePayPasswordData['payPassword'] = password_hash($updatePayPasswordData['payPassword'], PASSWORD_DEFAULT);
-        $result = $this->objMCustomer->updatePayPassword($updatePayPasswordData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 校验余额支付密码
-     */
-    public function checkPayPassword()
-    {
-        $params = $this->request->getRawJson();
-        if (!$params) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $checkPayPasswordData = [
-            'enterpriseId' => $this->onlineEnterpriseId,
-            'id' => getArrayItem($params, 'id'),
-            'payPassword' => trim(getArrayItem($params, 'payPassword')),
-        ];
-        foreach ($checkPayPasswordData as $key => $value) {
-            if (empty($value)) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCustomer->checkPayPassword($checkPayPasswordData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 获取所有的明细
-     */
-    public function getAllMemberBalanceDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['userCenterId'] = $this->onlineUserId;
-        $params['customerId'] = getArrayItem($params, 'customerId', '');
-        $returnData = $this->objMMemberBalanceDetail->getAllMemberBalanceDetail($params);
-
-        if ($returnData->isSuccess()) {
-            $returnData = $returnData->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 申请提现
-     */
-    public function addReflectDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $ReflectDetailDate = [
-            'customerId' => getArrayItem($params, 'customerId', ''),
-            'userCenterId' => $this->onlineUserId,
-            'reflectType' => getArrayItem($params, 'reflectType', ''),
-            'money' => getArrayItem($params, 'money', ''),
-            'reflectInfo' => getArrayItem($params, 'reflectInfo', []),
-            'reflectStatus' => getArrayItem($params, 'reflectStatus', 4),
-            'auditStatus' => getArrayItem($params, 'auditStatus', StatusCode::$auditStatus['auditing']),
-        ];
-        foreach ($ReflectDetailDate as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-        $ReflectDetailDate['reflectInfo'] = json_encode($ReflectDetailDate['reflectInfo']);
-        $ReflectDetailDate['remark'] = getArrayItem($params, 'remark', '');
-        $ReflectDetailDate['createTime'] = time();
-        $result = $this->objMReflectDetail->addReflectDetail($ReflectDetailDate);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 所有提现记录
-     */
-    public function getAllReflectDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['start'] = getArrayItem($params, 'start', "");
-        $params['end'] = getArrayItem($params, 'end', "");
-        $params['customerId'] = getArrayItem($params, 'customerId', '');
-
-        $returnData = $this->objMReflectDetail->getAllReflectDetail($params);
-
-        if ($returnData->isSuccess()) {
-            $returnData = $returnData->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
-        }
-    }
-
-
-    /**
-     * 积分流水
-     */
-    public function getAllCustomerIntegralDesc()
-    {
-        $params = $this->request->getRawJson();
-
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $data['customerId'] = $params['customerId'];
-        if (empty($params['customerId'])) {
-            parent::sendOutput('customerId参数为空', ErrorCode::$paramError);
-        }
-
-        if (isset($params['star']) && !empty($params['star']) && isset($params['end']) && !empty($params['end'])) {
-            $data['createTime'] = [
-                'star' => $params['star'],
-                'end' => $params['end']
-            ];
-        }
-
-        $modelResult = $this->objMCustomer->getAllCustomerIntegralDesc($data);
-        if (!$modelResult->isSuccess()) {
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 小程序充值
-     */
-    public function rechargeMemberBalance()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        //记录流水
-        $memberBalanceDetailData = [
-            'customerId' => $params['customerId'],
-            'type' => StatusCode::$standard,
-            'userCenterId' => $this->onlineUserId,
-            'money' => $params['money'],
-            'purpose' => '充值',
-            'orderIds' => '',
-            'remark' => '充值' . $params['money'],
-            'financeType' => '会员余额充值',
-        ];
-        foreach ($memberBalanceDetailData as $k => $v) {
-            if (in_array($k, ['customerId', 'money', 'purpose']) && empty($v)) {
-                $this->sendOutput('请输入' . $k, ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMMemberBalanceDetail->addMemberBalanceDetail($memberBalanceDetailData);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 小程序客户余额明细列表
-     */
-    public function getAllCustomerBalanceDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $selectParams = [
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-        ];
-
-        foreach ($selectParams as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $selectParams['start'] = !empty($params['start']) ? $params['start'] : 0;
-        $selectParams['end'] = !empty($params['end']) ? strtotime(date('Y-m-d', $params['end']) . '23:59:59') : time();
-
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $result = $this->objMCustomerBalanceDetail->getAllCustomerBalanceDetail($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-                'openingBalance' => $returnData['openingBalance'],
-                'endingBalance' => $returnData['endingBalance'],
-                'shouldReceiveTotal' => $returnData['shouldReceiveTotal'],
-                'actualReceiveTotal' => $returnData['actualReceiveTotal'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

+ 0 - 1298
Controller/Customer/Customer.Class.php

@@ -1,1298 +0,0 @@
-<?php
-/**
- * 客户管理模块
- * Created by PhpStorm.
- * User: tpl
- * Date: 2019/10/30
- * Time: 13:54
- */
-namespace JinDouYun\Controller\Customer;
-
-
-use JinDouYun\Dao\Department\DDepartment;
-use JinDouYun\Dao\Department\DStaff;
-use JinDouYun\Dao\Shop\DShop;
-use JinDouYun\Dao\SysAreaChina\DSysAreaChina;
-use JinDouYun\Dao\System\DCustomerSource;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-use Jindouyun\Cache\CustomerCache;
-
-use JinDouYun\Model\Customer\MCustomer;
-use JinDouYun\Model\Order\MOrder;
-use JinDouYun\Model\Customer\MReflectDetail;
-use JinDouYun\Model\Customer\MMemberBalanceDetail;
-
-
-
-use JinDouYun\Dao\Customer\DCustomer;
-use Util\Common\PartnerTools;
-
-
-class Customer extends BaseController
-{
-    /**
-     * @var MCustomer
-     */
-    private $objMReflectDetail;
-    private $objMMemberBalanceDetail;
-    private $objMCustomer;
-    
-    private $dbCustomer;
-    private $partnerTool;
-    //private $objTempSaveCache;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCustomer = new MCustomer($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objMReflectDetail = new MReflectDetail($this->onlineEnterpriseId,$this->onlineUserId);
-        $this->objMMemberBalanceDetail = new MMemberBalanceDetail($this->onlineEnterpriseId,$this->onlineUserId);
-        //$this->objTempSaveCache = new TempSaveCache();
-        
-        
-        //用户表
-        $this->dbCustomer = new DCustomer('default');
-        $customerTableName = $this->dbCustomer->getTableName($this->dbCustomer->get_Table(), $this->onlineEnterpriseId, 1);
-        $this->dbCustomer->setTable($customerTableName);
-        $this->partnerTool = new PartnerTools($this->onlineEnterpriseId);
-    }
-
-    /**
-     * 添加和编辑客户管理公共字段处理方法
-     *
-     * @return array
-     */
-    public function commonFieldFilter(){
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $customerData = [
-            'mobile' => isset($params['mobile']) ? $params['mobile'] : '',//账号
-            'name' => isset($params['name']) ? $params['name'] : '',
-            'type' => isset($params['type']) ? $params['type'] : '',//客户类型
-        ];
-
-        //非暂存则验空
-        if (!isset($params['tempSave']) || $params['tempSave'] == false) {
-            foreach($customerData as $key => $value){
-                if(empty($value) && $value !== 0){
-                    $this->sendOutput($key.'参数错误', ErrorCode::$paramError);
-                }
-            }
-        }
-        $customerData['enableStatus'] = isset($params['enableStatus']) ? $params['enableStatus'] : StatusCode::$standard;//启用状态
-        $customerData['contact'] = isset($params['contact']) ? $params['contact'] : '';
-        $customerData['provinceCode'] = isset($params['provinceCode']) ? $params['provinceCode'] : '';
-        $customerData['cityCode'] = isset($params['cityCode']) ? $params['cityCode'] : '';
-        $customerData['districtCode'] = isset($params['districtCode']) ? $params['districtCode'] : '';
-        $customerData['shopId'] = isset($params['shopId']) ? $params['shopId'] : '';
-
-        $customerData['longitude'] = isset($params['longitude']) ? $params['longitude'] : '';
-        $customerData['latitude']  = isset($params['latitude']) ? $params['latitude'] : '';
-
-        $customerData['tempSave']= isset($params['tempSave']) ? $params['tempSave'] : false;
-        $customerData['password'] = isset($params['password']) ? $params['password'] : '';//密码
-        $customerData['address'] = isset($params['address']) ? $params['address'] : '';
-        $customerData['managerMobile'] = isset($params['managerMobile']) ? $params['managerMobile'] : '';
-        $customerData['avatar'] = isset($params['avatar']) ? $params['avatar'] : '';//客户头像
-        // $customerData['sortingId'] = isset($params['sortingId']) ? $params['sortingId'] : '';
-        $customerData['departmentId'] = isset($params['departmentId']) ? $params['departmentId'] : '';
-        $customerData['salesManId'] = isset($params['salesManId']) ? $params['salesManId'] : '';
-        $customerData['salesManCode'] = isset($params['salesManCode']) ? $params['salesManCode'] : '';
-        $customerData['salesManName'] = isset($params['salesManName']) ? $params['salesManName'] : '';
-        $customerData['birthday'] = isset($params['birthday']) ? $params['birthday'] : '';
-        $customerData['remark'] = isset($params['remark']) ? $params['remark'] : '';
-        $customerData['deleteStatus']= StatusCode::$standard;
-        $customerData['status']= isset($params['status']) ? $params['status'] : '';
-        $customerData['area'] = isset($params['area']) ? $params['area'] : [];
-        $customerData['shopName'] = isset($params['shopName']) ? $params['shopName'] : '';
-        $customerData['reservoirId'] = isset($params['reservoirId']) ? $params['reservoirId'] : '';
-        (isset($params['extend']) && !empty($params['extend'])) && $customerData['extend'] = json_encode($params['extend']);
-        $customerData['memberBalance'] = getArrayItem($params, 'memberBalance','');
-        $customerData['recommenderType'] = getArrayItem($params,'recommenderType','');
-        $customerData['recommenderId'] =getArrayItem($params,'recommenderId','');
-        
-        $customerData['createTime'] = time();
-        $customerData['updateTime'] = time();
-        //联系人信息
-        $customerData['contact'] = getArrayItem($params,'contact', []);
-        return $customerData;
-    }
-
-    /**
-     * 添加客户
-     * @throws \Exception
-     */
-    public function addCustomer()
-    {
-        $customerData = $this->commonFieldFilter();
-        if ($customerData['tempSave']) {
-            //$this->objTempSaveCache->saveCustomer($this->onlineEnterpriseId, $this->onlineUserId, $customerData);
-            parent::sendOutput('暂存成功');
-        }
-
-        unset($customerData['tempSave']);
-        unset($customerData['area']);
-        unset($customerData['shopName']);
-        $result = $this->objMCustomer ->addCustomer($customerData);
-        if($result->isSuccess()){
-            //删除暂存数据
-            //$this->objTempSaveCache->delCustomer($this->onlineEnterpriseId, $this->onlineUserId);
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 获取暂存信息
-     */
-    public function getTempData()
-    {
-        //$result = $this->objTempSaveCache->getCustomer($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->sendOutput('');
-    }
-
-    /**
-     * 获取指定客户信息
-     * @throws \Exception
-     */
-    public function getCustomerInfo()
-    {
-        $customerId  = $this->request->param('request_id');
-        if ( !$customerId ) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError );
-        }
-
-        // 直接从缓存层返回
-        $objCustomerCache = new CustomerCache();
-        $customerData = $objCustomerCache->getCustomerData($this->onlineEnterpriseId, $customerId);
-        if( !empty($customerData) ){
-            $this->sendOutput($customerData);
-        }
-
-        $result = $this->objMCustomer->getCustomerInfo($customerId);
-        if($result->isSuccess()){
-            $objCustomerCache->cacheCustomerData($this->onlineEnterpriseId, $customerId, $result->getData());
-            $this->sendOutput($result->getData());
-        }else{
-            $this->sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 编辑客户
-     * @throws \Exception
-     */
-    public function editCustomer()
-    {
-        $customerId  = $this->request->param('request_id');
-        if(empty($customerId)){
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $customerData = $this->commonFieldFilter();
-        $customerData['id'] = $customerId;
-        unset($customerData['createTime']);
-        unset($customerData['status']);
-        unset($customerData['tempSave']);
-        unset($customerData['area']);
-        unset($customerData['shopName']);
-        $result = $this->objMCustomer->editCustomer($customerData);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-    
-    /**
-     * 更新用户分销推广信息
-     */
-    public function updateUserNewPartner(){
-        $params = $this->request->getRawJson();
-        $postData = [
-            'id' => isset($params['id']) ? (int)$params['id'] : 0,
-            'parentId' => isset($params['parentId']) ? (int)$params['parentId'] : 0,//上级id
-            'isPartner' => isset($params['isPartner']) ? (int)$params['isPartner'] : 0,//是否合伙人
-        ];
-        if(empty($postData["id"])){
-            parent::sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $postData["isPartner"] = $postData["isPartner"]===1?1:0;
-        $userData = $this->dbCustomer->get($postData["id"]);
-        if(empty($userData)){
-            parent::sendOutput('用户不存在', ErrorCode::$paramError);
-        }
-        $save=["isPartner"=>$postData["isPartner"]];
-        if($userData["parentId"]==0 && $postData["parentId"]!=0){
-            $this->partnerTool->setPushCustomer($postData["parentId"], $userData["id"]);
-        }
-        $this->dbCustomer->update($save,["id"=>$userData["id"]]);
-        parent::sendOutput("操作完成");
-    }
-
-    /**
-     * 后台批量分配部门及业务员
-     */
-    public function batchEditCustomer()
-    {
-
-        $params = $this->request->getRawJson();
-        $data = [
-            'ids' => isset($params['ids']) ? $params['ids'] : [],
-            'departmentId' => isset($params['departmentId']) ? $params['departmentId'] : 0,//部门id
-            'salesManId' => isset($params['salesManId']) ? $params['salesManId'] : 0,//业务员id
-        ];
-
-        foreach ($data as $key => $val){
-            if (empty($val)){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMCustomer->batchEditCustomer($data);
-        if(!$result->isSuccess()){
-            $objCustomerCache = new CustomerCache();
-            foreach ($data['ids'] as $key => $value){
-                $objCustomerCache->delCustomerData($this->onlineEnterpriseId, $value);
-            }
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 删除客户
-     * @throws \Exception
-     */
-    public function delCustomer()
-    {
-       $userCenterIds = $this->request->getRawJson();
-        if(!$userCenterIds){
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $result = $this->objMCustomer->delCustomer($userCenterIds);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户启用和禁用
-     * @throws \Exception
-     */
-    public function updateCustomerStatus()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params['id']) &&  empty($params['enableStatus'])){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $result = $this->objMCustomer->updateCustomerStatus($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户审核通过和审核拒绝
-     * @throws \Exception
-     */
-    public function updateCustomerCheckStatus()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params['id']) &&  empty($params['status'])){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        if($params['status'] == StatusCode::$auditStatus['auditNotPass'] && !isset($params['reason'])) {
-            $this->sendOutput('请输入审核拒绝的原因', ErrorCode::$paramError );
-        }
-
-        $params['reason'] = isset($params['reason']) ? $params['reason'] : '';
-        $result = $this->objMCustomer->updateCustomerCheckStatus($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-
-    /**
-     * 后台所有客户列表
-     * @throws \Exception
-     */
-    public function getAllCustomer()
-    {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-
-        $condition = [
-            'status' => isset($params['status']) ? $params['status'] : 2,
-            'enableStatus' => getArrayItem($params, 'enableStatus', 0),
-            'keyword' => getArrayItem($params, 'keyword', ''),
-            'salesManId' => getArrayItem($params, 'salesManId', 0),
-            'shopId' => getArrayItem($params, 'shopId', 0),
-            'cityCode' => getArrayItem($params, 'cityCode', 0),
-            'districtCode' => getArrayItem($params, 'districtCode', 0),
-            'provinceCode' => getArrayItem($params, 'provinceCode', 0),
-            'offset'  => $pageParams['offset'],
-            'limit'   => $pageParams['limit'],
-        ];
-
-        $result = $this->objMCustomer->getAllCustomer($condition);
-        if($result->isSuccess()){
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 添加客户标签
-     * @throws \Exception
-     */
-    public function addCustomerTag() {
-        $params = $this->request->getRawJson();
-        if( empty($params['id']) && empty($params['tag']) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $result = $this->objMCustomer->addCustomerTag($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 删除客户标签
-     * @throws \Exception
-     */
-    public function delCustomerTag() {
-        $params = $this->request->getRawJson();
-        if( empty($params['id']) && empty($params['tag']) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $result = $this->objMCustomer->delCustomerTag($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 搜索
-     */
-    public function search() {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $selectParams = [
-            'keyword' => isset($params['keyword']) ? $params['keyword'] : '',
-            'type' => isset($params['type']) ? $params['type'] : '',
-            'provinceCode' => isset($params['provinceCode']) ? $params['provinceCode'] : '',
-            'cityCode' => isset($params['cityCode']) ? $params['cityCode'] : '',
-            'districtCode' => isset($params['districtCode']) ? $params['districtCode'] : '',
-            'status' => isset($params['status']) ? $params['status'] : '',
-            'enableStatus' => isset($params['enableStatus']) ? $params['enableStatus'] : '',
-            'shopId' => isset($params['shopId']) ? $params['shopId'] : '',
-            'departmentId' => isset($params['departmentId']) ? $params['departmentId'] : '',
-            'salesManId' => isset($params['salesManId']) ? $params['salesManId'] : '',
-            'start' => isset($params['start']) ? $params['start'] : '',
-            'end' => isset($params['end']) ? $params['end'] : ''
-        ];
-
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $result = $this->objMCustomer->search($selectParams);
-        if($result->isSuccess()){
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户查询
-     * @throws \Exception
-     */
-    public function query() {
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $selectParams = [
-            'keyword' => isset($params['keyword']) ? $params['keyword'] : '',//关键字:客户姓名/手机号/负责人电话
-            'tag' => isset($params['tag']) ? $params['tag'] : '',//标签
-            'provinceCode' => isset($params['provinceCode']) ? $params['provinceCode'] : '',//区域
-            'cityCode' => isset($params['cityCode']) ? $params['cityCode'] : '',
-            'districtCode' => isset($params['districtCode']) ? $params['districtCode'] : '',
-            'enableStatus' => isset($params['enableStatus']) ? $params['enableStatus'] : '',//客户启用状态
-            'shopId' => isset($params['shopId']) ? $params['shopId'] : '',//所属商铺
-            'source' => isset($params['source']) ? $params['source'] : '',//来源
-            'salesManId' => isset($params['salesManId']) ? $params['salesManId'] : '',//业务员
-            'birthday_start' => isset($params['birthday_start']) ? $params['birthday_start'] : '',//客户生日 开始
-            'birthday_end' => isset($params['birthday_end']) ? $params['birthday_end'] : ''//客户生日 结束
-        ];
-
-        $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $result = $this->objMCustomer->query($selectParams);
-        if($result->isSuccess()){
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-                'customerTotalNum' => $this->objMCustomer->getCustomerTotalNum(),
-                'newCustomerNum'   => $this->objMCustomer->getNewCustomerNum(),
-                'interestCustomerNum' =>$this->objMCustomer->getInterestCustomerNum(),
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 根据code获取客户的经纬度信息
-     */
-    public function getCustomerLocation() {
-        $params = $this->request->getRawJson();
-        $code = isset($params['code']) ? $params['code'] : '';
-        $result = $this->objMCustomer->getCustomerLocation($code);
-        if($result->isSuccess()){
-            $returnData = $result->getData();
-            parent::sendOutput($returnData);
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 导出方法
-     * @throws \Exception
-     */
-    public function export()
-    {
-        $params = $this->request->getRawJson();
-        $selectParams = [
-            'keyword' => isset($params['keyword']) ? $params['keyword'] : '',
-            'type' => isset($params['type']) ? $params['type'] : '',
-            'provinceCode' => isset($params['provinceCode']) ? $params['provinceCode'] : '',
-            'cityCode' => isset($params['cityCode']) ? $params['cityCode'] : '',
-            'districtCode' => isset($params['districtCode']) ? $params['districtCode'] : '',
-            'status' => isset($params['status']) ? $params['status'] : '',
-            'enableStatus' => isset($params['enableStatus']) ? $params['enableStatus'] : '',
-            'shopId' => isset($params['shopId']) ? $params['shopId'] : '',
-            'departmentId' => isset($params['departmentId']) ? $params['departmentId'] : '',
-            'salesManId' => isset($params['salesManId']) ? $params['salesManId'] : '',
-            'start' => isset($params['start']) ? $params['start'] : '',
-            'end' => isset($params['end']) ? $params['end'] : ''
-        ];
-
-        $selectParams['limit'] = null;
-        $selectParams['offset'] = null;
-
-        $result = $this->objMCustomer->getAllCustomer($selectParams);
-        if($result->isSuccess() == false){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        $returnData = $result->getData();
-        $data = $returnData['data'];
-        //导出到本地
-        header ( "Content-type:application/vnd.ms-excel" );
-        header ( "Content-Disposition:filename=客户列表.csv" );
-        header ('Cache-Control: max-age=0');
-
-        $fp = fopen('php://output', 'a');
-
-        $head = ['客户名称','联系人','登录账号','客户类型','商铺','销售部门','业务员','账号状态','备注'];       //定义标题
-
-        foreach ($head as $i => $v) {
-            $head[$i] = mb_convert_encoding($v, 'GBK', 'utf-8');     //将中文标题转换编码,否则乱码
-        }
-
-        fputcsv($fp, $head);
-
-        $limit = 10000;
-        $num = 0;                                         //计数器
-        foreach ( $data as $v ) {                           //循环数据
-            $num++;
-            if($num == $limit){
-                ob_flush();         //释放内存
-                flush();
-            }
-            $rows=[
-                'name'=>$v['name'],
-                'contactName'=>empty($v['contact']) ? '' : $v['contact'][0]['name'],
-                'mobile' => $v['mobile'],
-                'customerType' => $v['customerType'],
-                'shopName' => $v['shopName'],
-                'departmentName' => $v['departmentName'],
-                'salesManName' => $v['salesManName'],
-                'enableStatus' => ($v['enableStatus'] == StatusCode::$standard) ? "启用" : "禁用",
-                'remark' => $v['remark'],
-            ];
-
-            foreach ( $rows as $kk => $vv){
-                $rs[$kk] = mb_convert_encoding($vv, 'GBK', 'utf-8');  //转译编码
-            }
-            fputcsv($fp, $rs);
-
-            $rows = [];
-        }
-    }
-
-    public function formatCustomer()
-    {
-        $result = $this->objMCustomer->formatCustomer();
-        if(!$result->isSuccess()){
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-
-    /**
-     * 充值记录列表
-     */
-    public function getAllRechargeBalance()
-    {
-        $params = $this->request->getRawJson();
-        if(empty($params)){
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $selectParams['shopId'] = isset($params['shopId']) ? $params['shopId'] : '';
-        foreach($selectParams as $key => $value){
-            if(empty($value)){
-                parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        $params['page'] = isset($params['page']) ? $params['page'] : 1;
-        $params['pageSize'] = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        if(isset($params['customerId'])){
-            $selectParams['customerId'] = $params['customerId'];
-        }
-
-        if(isset($params['userCenterId'])){
-            $selectParams['userCenterId'] = $params['userCenterId'];
-        }
-
-        $modelResult = $this->objMCustomer->getAllRechargeBalance($selectParams);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-
-        $pageData = [
-            'pageIndex' => $params['page'],
-            'pageSize' => $params['pageSize'],
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 首字母搜索客户
-     */
-    public function initialsSearch()
-    {
-        $params = $this->request->getRawJson();
-        $data['condition'] = isset($params['condition']) ? trim($params['condition']) : '';
-        $modelResult = $this->objMCustomer->initialsSearch($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * 初始化客户首字母
-     */
-    public function initialsCustomer()
-    {
-        $modelResult = $this->objMCustomer->initialsCustomer();
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        parent::sendOutput($modelResult->getData());
-    }
-
-    /**
-     * Doc: (des="查询客户商品购买记录")
-     * User: XMing
-     * Date: 2021/3/10
-     * Time: 10:54 上午
-     */
-    public function searchCustomerBuyLog()
-    {
-        $params = $this->request->getRawJson();
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $export = isset($params['export']) ? $params['export'] : 0;
-        $modelResult = $this->objMCustomer->searchCustomerBuyLog($params,$export);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * Doc: (des="销售排行")
-     * User: XMing
-     * Date: 2021/3/15
-     * Time: 10:06 上午
-     * @throws \Exception
-     */
-    public function salesManRank()
-    {
-        $params = $this->request->getRawJson();
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['startTime'] = getArrayItem($params, 'startTime', strtotime(date('y-m-d 00:00:00'))) ;
-        $params['endTime'] = getArrayItem($params, 'endTime', strtotime(date('y-m-d 23:59:59')));
-        $params['orderStatus'] = getArrayItem($params, 'orderStatus',[4,5]);
-        
-        $objMOrder = new MOrder($this->onlineUserId,$this->onlineEnterpriseId);
-        $export = isset($params['export']) ? $params['export'] : 0;
-        $modelResult = $objMOrder->salesManRank($params,$export);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 积分流水
-     */
-    public function getAllCustomerIntegralDesc()
-    {
-        $params = $this->request->getRawJson();
-
-        $page = isset($params['page']) ? $params['page'] : 1;
-        $pageSize = isset($params['pageSize']) ? $params['pageSize'] : 10;
-        $pageParams = pageToOffset($params['page'], $params['pageSize']);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $data['customerId'] = isset($params['customerId']) ? $params['customerId'] : '';
-
-        if(empty($data['customerId'])){
-            parent::sendOutput('customerId参数为空', ErrorCode::$paramError);
-        }
-
-        if(isset($params['star']) && !empty($params['star']) && isset($params['end']) && !empty($params['end'])){
-            $data['createTime'] = [
-                'star' => $params['star'],
-                'end' => $params['end']
-            ];
-        }
-
-        $modelResult = $this->objMCustomer->getAllCustomerIntegralDesc($data);
-        if(!$modelResult->isSuccess()){
-            parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
-        }
-        $returnData = $modelResult->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 修改积分
-     * @throws \Exception
-     */
-    public function updateCustomerIntegral()
-    {
-        $params = $this->request->getRawJson();
-        $data = [
-            'integral' => isset($params['integral']) ? $params['integral'] : '',
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-            'type' => isset($params['type']) ? $params['type'] : '',
-        ];
-        foreach($data as $key => $value){
-            if(empty($value)){
-                parent::sendOutput($key.'参数为空', ErrorCode::$paramError);
-            }
-        }
-        $data['desc'] = isset($params['desc']) ? $params['desc'] : '';
-        if($this->shopId){
-            $data['shopId'] = $this->shopId;
-        }
-
-        $result = $this->objMCustomer->updateCustomerIntegral($data);
-        if(!$result->isSuccess()){
-            $objCustomerCache = new CustomerCache();
-            $objCustomerCache->delCustomerData($this->onlineEnterpriseId, $params['customerId']);
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-
-    /**
-     * 新注册未下单统计
-     */
-    public function noOrderCustomer()
-    {
-        $params = $this->request->getRawJson();
-        if(!$params){
-            parent::sendOutput('请求参数为空', ErrorCode::$paramError);
-        }
-
-        $data = [
-            'intervalDay' => getArrayItem($params, 'intervalDay', 10),
-            'customerName' => getArrayItem($params, 'customerName'),
-            'salesManId' => getArrayItem($params, 'salesManId'),
-            'provinceCode' => getArrayItem($params, 'provinceCode'),
-            'cityCode' => getArrayItem($params, 'cityCode'),
-            'districtCode' => getArrayItem($params, 'districtCode'),
-        ];
-
-        $page = getArrayItem($params, 'page', 1);
-        $pageSize = getArrayItem($params, 'pageSize', 10);
-        $pageParams = pageToOffset($page, $pageSize);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $returnData = $this->objMCustomer->noOrderCustomer($data);
-        if(!$returnData->isSuccess()){
-            parent::sendOutput($returnData->getData(), $returnData->getErrorCode());
-        }
-        $returnData = $returnData->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 距离最近一次未下单统计
-     */
-    public function intervalNoOrderCustomer()
-    {
-        $params = $this->request->getRawJson();
-        if(!$params){
-            parent::sendOutput('请求参数为空', ErrorCode::$paramError);
-        }
-
-        $data = [
-            'intervalDay' => getArrayItem($params, 'intervalDay', 10),
-            'customerName' => getArrayItem($params, 'customerName'),
-            'salesManId' => getArrayItem($params, 'salesManId'),
-            'provinceCode' => getArrayItem($params, 'provinceCode'),
-            'cityCode' => getArrayItem($params, 'cityCode'),
-            'districtCode' => getArrayItem($params, 'districtCode'),
-        ];
-
-        $page = getArrayItem($params, 'page', 1);
-        $pageSize = getArrayItem($params, 'pageSize', 10);
-        $pageParams = pageToOffset($page, $pageSize);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $returnData = $this->objMCustomer->intervalNoOrderCustomer($data);
-        if(!$returnData->isSuccess()){
-            parent::sendOutput($returnData->getData(), $returnData->getErrorCode());
-        }
-        $returnData = $returnData->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-    /**
-     * 拉新统计
-     */
-    public function recommenderStatic()
-    {
-        $params = $this->request->getRawJson();
-        if(!$params){
-            parent::sendOutput('请求参数为空', ErrorCode::$paramError);
-        }
-
-        $data = [
-            'startTime' => getArrayItem($params, 'startTime', 0),
-            'endTime' => getArrayItem($params, 'endTime', 0),
-            'customerId' => getArrayItem($params, 'customerId', 0),
-            'staffId' => getArrayItem($params, 'staffId', 0),
-        ];
-
-        $page = getArrayItem($params, 'page', 1);
-        $pageSize = getArrayItem($params, 'pageSize', 10);
-        $pageParams = pageToOffset($page, $pageSize);
-        $data['limit'] = $pageParams['limit'];
-        $data['offset'] = $pageParams['offset'];
-
-        $returnData = $this->objMCustomer->recommenderStatic($data);
-        if(!$returnData->isSuccess()){
-            parent::sendOutput($returnData->getData(), $returnData->getErrorCode());
-        }
-        $returnData = $returnData->getData();
-        $pageData = [
-            'pageIndex' => $page,
-            'pageSize' => $pageSize,
-            'pageTotal' => $returnData['total'],
-        ];
-        parent::sendOutput($returnData['data'], 0, $pageData);
-    }
-
-
-    //审核,打款公共方法
-    public function updateReflectDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params['id']) || empty($params['createTime'])) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $result = $this->objMReflectDetail->updateReflectDetail($params);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 所有提现记录
-     */
-    public function getAllReflectDetail()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $params['limit'] = $pageParams['limit'];
-        $params['offset'] = $pageParams['offset'];
-        $params['start'] = getArrayItem($params,'start',"");
-        $params['end'] = getArrayItem($params,'end',"");
-        $params['customerId'] = getArrayItem($params,'customerId', '');
-        $params['reflectStatus'] = getArrayItem($params,'reflectStatus', '');
-        $params['auditStatus'] = getArrayItem($params,'auditStatus', '');
-        $params['reflectType'] = getArrayItem($params,'reflectType', '');//提现类型
-
-        $returnData = $this->objMReflectDetail->getAllReflectDetail($params);
-
-        if ($returnData->isSuccess()) {
-            $returnData = $returnData->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 后台充值
-     */
-    public function rechargeMemberBalance()
-    {
-
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        //记录流水
-        $memberBalanceDetailData = [
-            'customerId' => $params['customerId'],
-            'type'       => $params['type'],
-            'userCenterId' => $this->onlineUserId,
-            'money'         =>$params['money'],
-            'purpose'    => isset($params['purpose']) ? $params['purpose']: 0,
-            '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']: '',
-        ];
-        foreach ($memberBalanceDetailData as $k =>$v) {//,'accountId','accountName','accountNumber'
-            if(in_array($k, ['customerId','money','purpose']) && empty($v)) {
-                $this->sendOutput('请输入'.$k, ErrorCode::$paramError);
-            }
-        }
-        $result = $this->objMMemberBalanceDetail->addMemberBalanceDetail($memberBalanceDetailData,$isbackstage=true);
-        if (!$result->isSuccess()) {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-        parent::sendOutput($result->getData());
-    }
-    
-    /**
-     * 接收导入客户数据参数
-     * @throws \Exception
-     */
-    public function getCustomerBasicImportParams()
-    {
-   
-        //获取数据文件
-        $params = $this->request->getRawJson();
-        //企业id
-        $enterpriseId = $this->onlineEnterpriseId;
-        
-        //引用dao
-        $objDSysAreaChina = new DSysAreaChina(); //省市区dao
-        $objDShop = new DShop();//商铺dao
-        $objDShop->setTable('qianniao_shop_1' );
-        $objDDepartment = new DDepartment();//销售部门dao
-        $objDDepartment->setTable('qianniao_department_' . $enterpriseId);
-        $objDDStaff = new DStaff();//员工表
-        $objDDStaff->setTable('qianniao_staff_' . $enterpriseId);
-        //获取数据
-        $postArray = [];
-        foreach ($params as $value) {
-            $customerArray = $value;
-            //客户信息
-            $name       = isset($customerArray['name']) ? trim($customerArray['name']) : '';//客户名称
-            $mobile     = isset($customerArray['mobile']) ? trim($customerArray['mobile']) : '';//登录账号
-            $contacts   = isset($customerArray['contacts']) ? trim($customerArray['contacts']) : '';//联系人
-            $nameMobile = isset($customerArray['nameMobile']) ? trim($customerArray['nameMobile']) : 4;//联系人电话
-            $birthday   = isset($customerArray['birthday']) ? trim($customerArray['birthday']) : '';//客户生日
-            $remark     = isset($customerArray['remark']) ? trim($customerArray['remark']) : '';//客户备注
-            $customerType = isset($customerArray['type']) ? trim($customerArray['type']) : '';//客户类型
-    
-            //省市区
-            $provinceName = isset($customerArray['provinceName']) ? trim($customerArray['provinceName']) : '';//省名称
-            $cityName     = isset($customerArray['cityName']) ? trim($customerArray['cityName']) : '';//市名称
-            $areaName     = isset($customerArray['areaName']) ? trim($customerArray['areaName']) : '';//区名称
-            $address      = isset($customerArray['address']) ? trim($customerArray['address']) : '';//详细地址
-
-            $shopName     = isset($customerArray['shopName']) ? trim($customerArray['shopName']) : '';//商铺名称
-            $departmentId = isset($customerArray['departmentId']) ? trim($customerArray['departmentId']) : '';//销售部门id
-            $salesManId = isset($customerArray['salesManId']) ? trim($customerArray['salesManId']) : '';//业务员Id
-            $salesManCode = createCode(StatusCode::$code['staff']['prefix'],$salesManId, StatusCode::$code['staff']['length']);
-    
-            if (empty($name)) {
-                continue;
-            }
-//            //业务员
-//            $salesManId = 0;
-//            $salesManCode ='';
-//            if(!empty($salesManName)){
-//                $dbResult = $objDDStaff->get(['staffName'=> $salesManName]);
-//                if($dbResult !== false){
-//                  $salesManId = $dbResult['id'];
-//                    $salesManCode = createCode(StatusCode::$code['staff']['prefix'],$salesManId, StatusCode::$code['staff']['length']);
-//
-//                }
-//            }
-            //商铺
-            $shopId = 0;
-            if(!empty($shopName)){
-                $dbResult = $objDShop->get(['name'=>$shopName]);
-                if($dbResult !== false){
-                    $shopId = $dbResult['id'];
-                }
-            }
-            //销售部门
-//            $departmentId = 0;
-//            if(!empty($departmentName)){
-//                $dbResult = $objDDepartment->get(['departmentName'=>$departmentName]);
-//                if($dbResult !== false){
-//                    $departmentId = $dbResult['id'];
-//                }
-//            }
-            //省市区
-            $provinceCode ='';
-            $cityCode = '';
-            $areaCode = '';
-            if(!empty($provinceName)){
-                //省编码
-                $dbResult = $objDSysAreaChina->get(['name'=>$provinceName]);
-                if($dbResult !== false){
-                    $provinceCode = $dbResult['code'];
-                    //市编码
-                    $dbResult = $objDSysAreaChina->get(['name'=>$cityName,'pcode'=>$provinceCode]);
-                    if($dbResult !== false){
-                        $cityCode = $dbResult['code'];
-                        //区编码
-                        $dbResult = $objDSysAreaChina->get(['name'=>$areaName,'pcode'=>$cityCode]);
-                        if($dbResult !== false){
-                            $areaCode = $dbResult['code'];
-                        }
-                    }
-                }
-               
-            }
-            
-            $postData =  array (
-                        'tempSave' => '',
-                        'latitude' => '',
-                        'longitude' => '',
-                        'password' => '',
-                        'area' => '',
-                        'mobile' => $mobile,
-                        'enableStatus' => 5,
-                        'name' => $name,
-                        'code' => '',
-                        'type' => $customerType,
-                        'provinceCode' => $provinceCode,
-                        'cityCode' => $cityCode,
-                        'districtCode' => $areaCode,
-                        'address' => $address,
-                        'managerMobile' => '',
-                        'shopId' => $shopId,
-                        'departmentId' => $departmentId,
-                        'salesManId' => $salesManId,
-                        'salesManCode' => $salesManCode,
-                        'salesManName' => '',
-                        'birthday' => $birthday,
-                        'remark' => $remark,
-                        'reservoirId' => $customerType,
-                        'recommenderType' => '',
-                        'recommenderId' => '',
-                        'extend' =>
-                            array (
-                                'license' => '',
-                            ),
-                        'contact' =>
-                            array (
-                                'area' => '',
-                                'name' => $contacts,
-                                'mobile' => $nameMobile,
-                                'provinceCode' => $provinceCode,
-                                'cityCode' => $cityCode,
-                                'districtCode' => $areaCode,
-                                'address' => $address,
-                            ),
-                    );
-            
-            $postArray[] = $postData;
-        }
-        return $postArray;
-    }
-    
-    /**
-     * 导入客户资料
-     * @throws \Exception
-     */
-    public function customerImport()
-    {
-        //把页面传来的参数对应到符合的字段中全部传递过来;
-        $paramsArray = self::getCustomerBasicImportParams();
-        if (empty($paramsArray)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-       
-        $customerBasic = [];
-        foreach ($paramsArray as $params) {
-            $customerData = [
-                'mobile' => isset($params['mobile']) ? $params['mobile'] : '',//账号
-                'name' => isset($params['name']) ? $params['name'] : '',
-                'type' => isset($params['type']) ? $params['type'] : '',//客户类型
-            ];
-            //非暂存则验空
-            if (!isset($params['tempSave']) || $params['tempSave'] == false) {
-                foreach ($customerData as $key => $value) {
-                    if (empty($value) && $value !== 0) {
-                        $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-                    }
-                }
-            }
-            $customerData['enableStatus'] = isset($params['enableStatus']) ? $params['enableStatus'] : StatusCode::$standard;//启用状态
-            $customerData['contact'] = isset($params['contact']) ? $params['contact'] : '';
-            $customerData['provinceCode'] = isset($params['provinceCode']) ? $params['provinceCode'] : '';
-            $customerData['cityCode'] = isset($params['cityCode']) ? $params['cityCode'] : '';
-            $customerData['districtCode'] = isset($params['districtCode']) ? $params['districtCode'] : '';
-            $customerData['shopId'] = isset($params['shopId']) ? $params['shopId'] : '';
-            $customerData['longitude'] = isset($params['longitude']) ? $params['longitude'] : '';
-            $customerData['latitude'] = isset($params['latitude']) ? $params['latitude'] : '';
-            $customerData['tempSave'] = isset($params['tempSave']) ? $params['tempSave'] : false;
-            $customerData['password'] = isset($params['password']) ? $params['password'] : '';//密码
-            $customerData['address'] = isset($params['address']) ? $params['address'] : '';
-            $customerData['managerMobile'] = isset($params['managerMobile']) ? $params['managerMobile'] : '';
-            $customerData['avatar'] = isset($params['avatar']) ? $params['avatar'] : '';//客户头像
-            // $customerData['sortingId'] = isset($params['sortingId']) ? $params['sortingId'] : '';
-            $customerData['departmentId'] = isset($params['departmentId']) ? $params['departmentId'] : '';
-            $customerData['salesManId'] = isset($params['salesManId']) ? $params['salesManId'] : '';
-            $customerData['salesManCode'] = isset($params['salesManCode']) ? $params['salesManCode'] : '';
-            $customerData['salesManName'] = isset($params['salesManName']) ? $params['salesManName'] : '';
-            $customerData['birthday'] = isset($params['birthday']) ? $params['birthday'] : '';
-            $customerData['remark'] = isset($params['remark']) ? $params['remark'] : '';
-            $customerData['deleteStatus'] = StatusCode::$standard;
-            $customerData['status'] = isset($params['status']) ? $params['status'] : '';
-            $customerData['area'] = isset($params['area']) ? $params['area'] : [];
-            $customerData['shopName'] = isset($params['shopName']) ? $params['shopName'] : '';
-            $customerData['reservoirId'] = isset($params['reservoirId']) ? $params['reservoirId'] : '';
-            (isset($params['extend']) && !empty($params['extend'])) && $customerData['extend'] = json_encode($params['extend']);
-            $customerData['memberBalance'] = getArrayItem($params, 'memberBalance', '');
-            $customerData['recommenderType'] = getArrayItem($params, 'recommenderType', '');
-            $customerData['recommenderId'] = getArrayItem($params, 'recommenderId', '');
-    
-            $customerData['createTime'] = time();
-            $customerData['updateTime'] = time();
-            //联系人信息
-            $customerData['contact'] = getArrayItem($params, 'contact', []);
-            $customerBasic[] = $customerData;
-        }
-        unset($customerData);
-        
-        $total = 0;
-        $true  = 0;
-        $false = 0;
-        $exportError = date('Ymd_H:i:s').'.txt';
-        foreach ($customerBasic as $key => $customerData){
-            if ($customerData['tempSave']) {
-                parent::sendOutput('暂存成功');
-            }
-            unset($customerData['tempSave']);
-            unset($customerData['area']);
-            unset($customerData['shopName']);
-            $result = $this->objMCustomer ->addCustomer($customerData);
-            if(!$result->isSuccess()){
-                if(!is_dir(UPLOAD_FILE_PATH.'/exportError/')){
-                    mkdir(UPLOAD_FILE_PATH.'/exportError/',0777,true);
-                }
-                $a = $key+1;
-                file_put_contents(UPLOAD_FILE_PATH.'/exportError/'.$exportError,'第 '. $a .'行导入失败,原因'.var_export($result->getData().$result->getErrorCode(),true).PHP_EOL,FILE_APPEND);
-                $false++;
-            } else {
-                $true++;
-            }
-            $total++;
-        }
-        
-        $returnData = [
-            'successMsg' => '共'.$total.'条客户数据,成功'.$true.'条客户数据,失败'.$false.'条客户数据',
-            'errorNum'   => $false,
-            'url'        => URL_UPLOAD.'exportError/'.$exportError,
-        ];
-        parent::sendOutput($returnData);
-    }
-
-
-    /**
-     * 客户分布
-     */
-    public function getCustomerDistributed()
-    {
-        $returnData = $this->objMCustomer->getCustomerDistributed();
-        if(!$returnData->isSuccess()){
-            parent::sendOutput($returnData->getData(), $returnData->getErrorCode());
-        }
-        parent::sendOutput($returnData->getData());
-    }
-
-    /**
-     * 批量设置客户类型
-     */
-    public function setCustomerType()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $params['customerIds'] = getArrayItem($params,'customerIds',[]);
-        $params['type'] = getArrayItem($params,'type',0);
-
-        $result = $this->objMCustomer->setCustomerType($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    
-}

+ 0 - 288
Controller/Customer/CustomerCard.Class.php

@@ -1,288 +0,0 @@
-<?php
-/**
- * 商铺管理模块
- * Created by PhpStorm.
- * User: wxj
- * Date: 2019/10/31
- * Time: 15:02
- */
-namespace JinDouYun\Controller\Customer;
-
-use AlibabaCloud\SDK\Dingtalk\Vbizfinance_1_0\Models\QueryReceiptsBaseInfoResponseBody\list_\project;
-use JinDouYun\Model\Customer\MCustomerCard;
-use JinDouYun\Model\Department\MStaff;
-use JinDouYun\Model\Enterprise\MEnterprise;
-use JinDouYun\Model\Shop\MShopProject;
-use JinDouYun\Model\Shop\MShopRostering;
-use JinDouYun\Model\Shop\MShopSubscribe;
-use JinDouYun\Model\Shop\MShopTemplate;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\ResultWrapper;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Cache\ShopCache;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Shop\MShop;
-use JinDouYun\Cache\TempSaveCache;
-
-class CustomerCard extends BaseController
-{
-    private $obj;
-    private $objShopCache;
-    private $objTempSaveCache;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->obj = new MCustomerCard($this->onlineEnterpriseId, $this->onlineUserId);
-        $this->objShopCache = new ShopCache();
-        $this->objTempSaveCache = new TempSaveCache();
-    }
-
-    /**
-     * 添加和编辑商铺管理公共字段处理方法
-     *
-     * @return array
-     */
-    public function commonFieldFilter(){
-
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $shopData = [
-            'uid' => isset($params['uid']) ? $params['uid'] : '',
-            'customer_id' => isset($params['customer_id']) ? $params['customer_id'] : '',
-            'project' => isset($params['project']) ? $params['project'] : '',
-            'time' => isset($params['time']) ? $params['time'] : '',
-        ];
-
-        //非暂存则验空
-        if (!isset($params['tempSave']) || $params['tempSave'] == false) {
-            foreach($shopData as $key => $value){
-                if(empty($value) && $value !== 0){
-                    $this->sendOutput($key.'参数错误', ErrorCode::$paramError );
-                }
-            }
-        }
-
-        $shopData['remarks']= isset($params['remarks']) ? $params['remarks'] : false;
-        $shopData['pay_price']= isset($params['pay_price']) ? $params['pay_price'] : false;
-        $shopData['to_price']= isset($params['to_price']) ? $params['to_price'] : false;
-        $shopData['discount_price']= isset($params['discount_price']) ? $params['discount_price'] : false;
-        return $shopData;
-    }
-
-
-    public function add()
-    {
-        $addStaffData = $this->commonFieldFilter();
-
-        $project = $this->Mproject->select([['id', 'in', $addStaffData['project']]]);
-        $addStaffData['shop_id'] = $this->shopId;
-        $price = 0;
-        $service_time = 0;
-        foreach ($project as $item)
-        {
-            $price += $item['price'];
-            $service_time += $item['service_time'];
-        }
-        if ($addStaffData['to_price']){
-            $to_price = $addStaffData['to_price'];
-        }else{
-            $to_price = $price;
-        }
-        if ($addStaffData['pay_price']) {
-            $pay_price = $addStaffData['pay_price'];
-        }else{
-            $pay_price = $price - $addStaffData['discount_price'];
-        }
-        $addStaffData['pay_price'] = $pay_price;
-        $addStaffData['to_price'] = $to_price;
-        $addStaffData['service_time'] = $service_time;
-        $addStaffData['duration'] = $service_time;
-        $result = $this->obj->insert($addStaffData);
-
-        if ($result){
-            parent::sendOutput('添加成功');
-        }else{
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-
-    /**
-     * 修改2
-     * @return void
-     */
-    public function update()
-    {
-        $id = $this->request->param('id');
-        $param['project'] = $this->request->param('project');
-        $param['discount_price'] = $this->request->param('discount_price');
-        $param['to_price'] = $this->request->param('to_price');
-        $param['pay_price'] = $this->request->param('pay_price');
-        $param['time'] = $this->request->param('time');
-        $param['remarks'] = $this->request->param('remarks');
-
-        $data  = $this->obj->details(['id' => $id]);
-
-        if (!$data->isSuccess()) parent::sendOutput('订单不存在', $data->getErrorCode());
-
-        $param['time'] = strtotime($param['time']);
-        $res = $this->obj->update($param, $id);
-        if ($res->isSuccess()) {
-            parent::sendOutput('修改成功');
-        } else {
-            parent::sendOutput($res->getData(), $res->getErrorCode());
-        }
-    }
-
-    /**
-     * 列表
-     */
-    public function list()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        $selectParams['shop_id'] = $this->shopId;
-        //昵称
-        if(isset($params['nickname']) && !empty($params['nickname'])){
-            $selectParams['nickname'] = $params['nickname'];
-        }
-        //uid
-        if(isset($params['uid']) && !empty($params['uid'])){
-            $selectParams['uid'] = $params['uid'];
-        }
-        if(isset($params['customer_id']) && !empty($params['customer_id'])){
-            $selectParams['customer_id'] = $params['customer_id'];
-        }
-
-
-        // 时间
-        if(isset($params['start_time']) && !empty($params['start_time']) and isset($params['end_time']) && !empty($params['end_time'])){
-            $response = [];
-
-            $dt_start = strtotime($params['start_time']);
-            $dt_end   = strtotime($params['end_time']);
-            while ($dt_start <= $dt_end) {
-                array_push($response, date('Y-m-d', $dt_start));
-                $dt_start = strtotime('+1 day', $dt_start);
-            }
-
-            $selectParams['time'] = $response;
-        }
-
-
-        $result = $this->obj->list($selectParams);
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize' => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0,$pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-
-    }
-
-    public function complete()
-    {
-        $params = $this->request->getRawJson();
-        if (!$params['id']) $this->sendOutput('参数为空', ErrorCode::$paramError);
-        $data = $this->obj->details(['id' => $params['id']]);
-
-        if (!$data->isSuccess()) parent::sendOutput('订单不存在', $data->getErrorCode());
-        $data = $data->getData();
-        if ($data['status'] == 1) parent::sendOutput('订单已完成', 1005);
-
-        $reward = 0;
-        foreach ($data['project'] as $item){
-            $reward += $item['price'] * ($item['commission']/100);
-        }
-        $this->staff->service($reward,  $data['uid'], $this->shopId, $data['id']);
-        $res = $this->obj->update(['status'=> 1, 'paid' => 1], $params['id']);
-        if ($res->isSuccess()) {
-            parent::sendOutput('修改成功');
-        } else {
-            parent::sendOutput($res->getData(), $res->getErrorCode());
-        }
-
-    }
-
-
-    /**
-     * 取消预约订单
-     * @return void
-     */
-    public function cancel()
-    {
-        $params = $this->request->getRawJson();
-        if (!$params['id']) $this->sendOutput('参数为空', ErrorCode::$paramError);
-        $data = $this->obj->details(['id' => $params['id']]);
-
-        if (!$data->isSuccess()) parent::sendOutput('订单不存在', $data->getErrorCode());
-        $data = $data->getData();
-        if ($data['status'] == 1) parent::sendOutput('订单已完成', 1005);
-
-        $res = $this->obj->update(['status'=> -1], $params['id']);
-        if ($res->isSuccess()) {
-            parent::sendOutput('取消成功');
-        } else {
-            parent::sendOutput($res->getData(), $res->getErrorCode());
-        }
-
-    }
-
-
-
-    /**
-     * 详情
-     * @return void
-     */
-    public function details()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        if(!empty($params['id'])){
-            $selectParams['id'] = $params['id'];
-        }
-        $result = $this->obj->details($selectParams);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-
-    public function delete()
-    {
-
-        $id['id'] = $this->request->param('id');
-        if (empty($id['id'])) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-
-        $result = $this->obj->delete($id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-}

+ 0 - 253
Controller/Customer/CustomerCommunication.Class.php

@@ -1,253 +0,0 @@
-<?php
-/**
- * 客户沟通记录Controller
- * Created by PhpStorm.
- * User: haoren
- * Date: 2021/02/23
- * Time: 13:00
- */
-
-namespace JinDouYun\Controller\Customer;
-
-use Exception;
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use JinDouYun\Controller\BaseController;
-
-use JinDouYun\Model\Customer\MCustomerCommunication;
-
-class CustomerCommunication extends BaseController
-{
-    private $objMCustomerCommunication;
-
-    public function __construct($isCheckAcl = false, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCustomerCommunication = new MCustomerCommunication($this->onlineEnterpriseId,$this->onlineUserId);
-    }
-
-    /**
-     * 获取参数
-     * @return array
-     */
-    public function commonFieldFilter()
-    {
-        $params = $this->request->getRawJson();
-        if (empty($params)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $data = [
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-            'staffId' => isset($params['staffId']) ? $params['staffId'] : '',
-            'content' => isset($params['content']) ? $params['content'] : '',
-        ];
-
-        //必填项
-        foreach ($data as $key => $value) {
-            if (empty($value) && $value !== 0) {
-                $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
-            }
-        }
-
-        //选填项
-        $data['time']     = isset($params['time']) && !empty($params['time']) ? $params['time'] : time();
-        $data['location'] = isset($params['location']) && !empty($params['location']) ? $params['location'] : '';
-        $data['picture']  = isset($params['picture']) && !empty($params['picture']) ? $params['picture'] : '';
-        return $data;
-    }
-
-    /**
-     * 客户沟通记录添加
-     */
-    public function addCustomerCommunication()
-    {
-        $data = $this->commonFieldFilter();
-        $result = $this->objMCustomerCommunication->addCustomerCommunication($data);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户沟通记录删除
-     * @throws Exception
-     */
-    public function delCustomerCommunication()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMCustomerCommunication->delCustomerCommunication($id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户沟通记录修改
-     */
-    public function updateCustomerCommunication()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('id参数为空', ErrorCode::$paramError);
-        }
-        $data = $this->commonFieldFilter();
-
-        $result = $this->objMCustomerCommunication->updateCustomerCommunication($data, $id);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户沟通记录列表
-     */
-    public function getAllCustomerCommunication()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-
-        if(isset($params['customerId']) && !empty($params['customerId'])){
-            $selectParams['customerId'] = $params['customerId'];
-        }
-
-        if(isset($params['staffId']) && !empty($params['staffId'])){
-            $selectParams['staffId'] = $params['staffId'];
-        }
-
-        if(isset($params['start']) && !empty($params['start'])){
-            $selectParams['start'] = $params['start'];
-        }
-
-        if(isset($params['end']) && !empty($params['end'])){
-            $selectParams['end'] = $params['end'];
-        }
-
-        $result = $this->objMCustomerCommunication->getAllCustomerCommunication($selectParams);
-
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-
-    /**
-     * 客户沟通记录详情
-     */
-    public function getCustomerCommunication()
-    {
-        $id = $this->request->param('request_id');
-        if (empty($id)) {
-            $this->sendOutput('参数为空', ErrorCode::$paramError);
-        }
-        $result = $this->objMCustomerCommunication->getCustomerCommunication(['id' => $id]);
-        if ($result->isSuccess()) {
-            parent::sendOutput($result->getData());
-        } else {
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-    
-    /**
-     * 客户拜访报表
-     */
-    public function getCustomerCallOnReportForm()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $selectParams['departmentId'] = isset($params['departmentId']) ? $params['departmentId'] :'';
-        $selectParams['start'] = isset($params['start']) ? $params['start'] :'';
-        $selectParams['end'] = isset($params['end']) ? $params['end'] :'';
-        $result = $this->objMCustomerCommunication->getCustomerCallOnReportForm($selectParams);
-        
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-    
-    /**
-     * 客户拜访记录详情
-     */
-    public function getCustomerVisitInfo()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $selectParams['staffId'] = getArrayItem($params,'staffId');
-        
-        $result = $this->objMCustomerCommunication->getCustomerVisitInfo($selectParams);
-        
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-    
-    /**
-     * 未拜访客户统计列表
-     */
-    public function getCustomerNoVisit()
-    {
-        $params = $this->request->getRawJson();
-        $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
-        $selectParams['limit'] = $pageParams['limit'];
-        $selectParams['offset'] = $pageParams['offset'];
-        $selectParams['days'] = getArrayItem($params,'intervalDay',0);
-        $selectParams['customerName'] = getArrayItem($params,'customerName');//客户id
-        $selectParams['staffId'] = getArrayItem($params,'staffId');//员工id
-        $selectParams['province'] = getArrayItem($params,'province');
-        $selectParams['city'] = getArrayItem($params,'city');
-        $selectParams['district'] = getArrayItem($params,'district');
-        $result = $this->objMCustomerCommunication->getCustomerNoVisit($selectParams);
-        
-        if ($result->isSuccess()) {
-            $returnData = $result->getData();
-            $pageData = [
-                'pageIndex' => $params['page'],
-                'pageSize'  => $params['pageSize'],
-                'pageTotal' => $returnData['total'],
-            ];
-            parent::sendOutput($returnData['data'], 0, $pageData);
-        } else {
-            parent::sendOutput($result->getData(), ErrorCode::$dberror);
-        }
-    }
-}

+ 0 - 182
Controller/Customer/CustomerContact.Class.php

@@ -1,182 +0,0 @@
-<?php
-/**
- * 客户联系人管理模块
- * Created by PhpStorm.
- * User: tpl
- * Date: 2019/10/30
- * Time: 13:54
- */
-namespace JinDouYun\Controller\Customer;
-
-use Mall\Framework\Core\ErrorCode;
-use Mall\Framework\Core\StatusCode;
-
-use Jindouyun\Cache\CustomerCache;
-use JinDouYun\Controller\BaseController;
-use JinDouYun\Model\Customer\MCustomerContact;
-
-class CustomerContact extends BaseController
-{
-    private $objMCustomerContact;
-
-    public function __construct($isCheckAcl = true, $isMustLogin = true)
-    {
-        parent::__construct($isCheckAcl, $isMustLogin);
-        $this->objMCustomerContact = new MCustomerContact($this->onlineEnterpriseId, $this->onlineUserId);
-    }
-
-    /**
-     * 添加和编辑客户联系人管理公共字段处理方法
-     *
-     * @return array
-     */
-    public function commonFieldFilter(){
-
-        $params = $this->request->getRawJson();
-        if( empty($params) ){
-            $this->sendOutput('参数为空', ErrorCode::$paramError );
-        }
-
-        $customerContactData = [
-            'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
-            'name' => isset($params['name']) ? $params['name'] : '',
-            'mobile' => isset($params['mobile']) ? $params['mobile'] : '',
-        ];
-        foreach($customerContactData as $key => $value){
-            if(empty($value) && $value !== 0){
-                $this->sendOutput($key.'参数错误', ErrorCode::$paramError );
-            }
-        }
-
-        $customerContactData['provinceCode'] = isset($params['provinceCode']) ? $params['provinceCode'] : '';
-        $customerContactData['cityCode'] = isset($params['cityCode']) ? $params['cityCode'] : '';
-        $customerContactData['districtCode'] = isset($params['districtCode']) ? $params['districtCode'] : '';
-        $customerContactData['address'] = isset($params['address']) ? $params['address'] : '';
-        $customerContactData['deleteStatus']= StatusCode::$standard;
-        $customerContactData['createTime'] = time();
-        $customerContactData['updateTime'] = time();
-        return $customerContactData;
-    }
-
-    /**
-     * 添加客户联系人
-     */
-    public function addCustomerContact()
-    {
-        $customerContactData = $this->commonFieldFilter();
-
-        $result = $this->objMCustomerContact->addCustomerContact($customerContactData);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 获取指定客户联系人信息
-     */
-    public function getCustomerContactInfo()
-    {
-        $customerContactId  = $this->request->param('request_id');
-
-        if ( !$customerContactId ) {
-            $this->sendOutput('参数错误', ErrorCode::$paramError );
-        }
-
-        $result = $this->objMCustomerContact->getCustomerContactInfo($customerContactId);
-
-        if($result->isSuccess()){
-            $this->sendOutput($result->getData());
-        }else{
-            $this->sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 编辑客户联系人
-     */
-    public function editCustomerContact()
-    {
-        $customerContactId  = $this->request->param('request_id');
-        if(empty($customerContactId)){
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-        $customerContactData = $this->commonFieldFilter();
-        $customerContactData['id'] = $customerContactId;
-        unset($customerContactData['createTime']);
-
-        $result = $this->objMCustomerContact->editCustomerContact($customerContactData);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-
-    }
-
-    /**
-     * 删除客户联系人
-     */
-    public function delCustomerContact()
-    {
-        $customerContactId  = $this->request->param('request_id');
-        if(!$customerContactId){
-            $this->sendOutput('参数错误', ErrorCode::$paramError);
-        }
-
-        $result = $this->objMCustomerContact->delCustomerContact($customerContactId);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-    /**
-     * 客户联系人启用和禁用
-     */
-    public function updateCustomerContactStatus()
-    {
-        $params['id']  = $this->request->param('request_id');
-        $params['type']  = $this->request->param('type');
-
-
-        if($params['type'] == 1){ //启用
-            $params['enableStatus'] = StatusCode::$standard;
-        }else if($params['type'] == 2){ //停用
-            $params['enableStatus'] = StatusCode::$offline;
-        }
-
-        foreach($params as $key => $value){
-            if(empty($value)){
-                $this->sendOutput($key.'参数错误', ErrorCode::$paramError );
-            }
-        }
-
-        unset($params['type']);
-
-        $result = $this->objMCustomerContact->updateCustomerContactStatus($params);
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData());
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-
-
-    /**
-     * 后台所有客户联系人列表
-     */
-    public function getAllCustomerContact()
-    {
-        $result = $this->objMCustomerContact->getAllCustomerContact([],'*',true);
-
-        if($result->isSuccess()){
-            parent::sendOutput($result->getData(), 0);
-        }else{
-            parent::sendOutput($result->getData(), $result->getErrorCode());
-        }
-    }
-}

Some files were not shown because too many files changed in this diff