| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com
- * =========================================================
- */
- namespace app\model\member;
- use app\model\system\Document;
- use app\model\system\Config as ConfigModel;
- use app\model\BaseModel;
- /**
- * 会员设置
- */
- class Config extends BaseModel
- {
- /**
- * 注册协议
- * @param unknown $site_id
- * @param unknown $name
- * @param unknown $value
- */
- public function setRegisterDocument($title, $content, $site_id, $app_module = 'shop')
- {
- $document = new Document();
- $res = $document->setDocument($title, $content, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['document_key', '=', 'REGISTER_AGREEMENT']]);
- return $res;
- }
- /**
- * 查询注册协议
- * @param unknown $where
- * @param unknown $field
- * @param unknown $value
- */
- public function getRegisterDocument($site_id, $app_module = 'shop')
- {
- $document = new Document();
- $info = $document->getDocument([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['document_key', '=', 'REGISTER_AGREEMENT']]);
- return $info;
- }
- /**
- * 注册规则
- * array $data
- */
- public function setRegisterConfig($data, $site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->setConfig($data, '注册规则', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'REGISTER_CONFIG']]);
- return $res;
- }
- /**
- * 查询注册规则
- */
- public function getRegisterConfig($site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'REGISTER_CONFIG']]);
- if (empty($res['data']['value'])) {
- //默认值设置
- $res['data']['value'] = [
- 'login' => 'username,mobile',
- 'register' => 'username,mobile',
- 'third_party' => 1,
- 'bind_mobile' => 0,
- 'pwd_len' => 6,
- 'pwd_complexity' => ''
- ];
- } else {
- $value = $res['data']['value'];
- $value['login'] = $value['login'] ?? 'username,mobile';
- $value['register'] = $value['register'] ?? 'username,mobile';
- $value['third_party'] = $value['third_party'] ?? 0;
- $value['bind_mobile'] = $value['bind_mobile'] ?? 0;
- $res['data']['value'] = $value;
- }
- return $res;
- }
- /**
- * 注销协议
- * @param unknown $site_id
- * @param unknown $name
- * @param unknown $value
- */
- public function setCancelDocument($title, $content, $site_id, $app_module = 'shop')
- {
- $document = new Document();
- $res = $document->setDocument($title, $content, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['document_key', '=', 'CANCEL_AGREEMENT']]);
- return $res;
- }
- /**
- * 查询注销协议
- * @param unknown $where
- * @param unknown $field
- * @param unknown $value
- */
- public function getCancelDocument($site_id, $app_module = 'shop')
- {
- $document = new Document();
- $info = $document->getDocument([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['document_key', '=', 'CANCEL_AGREEMENT']]);
- return $info;
- }
- /**
- * 注销规则
- * array $data
- */
- public function setCancelConfig($data, $site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->setConfig($data, '注销规则', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'CANCEL_CONFIG']]);
- return $res;
- }
- /**
- * 查询注销规则
- */
- public function getCancelConfig($site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'CANCEL_CONFIG']]);
- if (empty($res['data']['value'])) {
- //默认值设置
- $res['data']['value'] = [
- 'is_enable' => 0, //注销开关
- 'is_audit' => 1, //审核开关
- ];
- }
- return $res;
- }
- /**
- * 查询会员配置
- * @param unknown $where
- * @param unknown $field
- * @param unknown $value
- */
- public function getMemberConfig($site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'MEMBER_LEVEL_CONFIG']]);
- if (empty($res['data']['value'])) {
- //默认值设置
- $res['data']['value'] = [
- 'is_update' => 1,
- ];
- } else {
- $value = $res['data']['value'];
- $value['is_update'] = $value['is_update'] ?? 1;
- $res['data']['value'] = $value;
- }
- return $res;
- }
- /**
- * 会员配置
- * array $data
- */
- public function setMemberConfig($data, $site_id, $app_module = 'shop')
- {
- $config = new ConfigModel();
- $res = $config->setConfig($data, '会员等级更新配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'MEMBER_LEVEL_CONFIG']]);
- return $res;
- }
- }
|