ShopApply.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\model\shop;
  13. use app\model\system\Group;
  14. use app\model\BaseModel;
  15. use app\model\express\Config as ConfigModel;
  16. use app\model\shop\ShopAccount as ShopaccountModel;
  17. use app\model\web\WebSite;
  18. /**
  19. * 店铺申请以及认证信息
  20. */
  21. class ShopApply extends BaseModel
  22. {
  23. //店铺申请状态
  24. private $apply_state = [
  25. -1 => '审核失败',
  26. -2 => '财务审核失败',
  27. 1 => '待审核',
  28. 2 => '财务凭据审核中',
  29. 3 => '入驻通过',
  30. ];
  31. /**
  32. * 申请店铺
  33. * @param unknown $apply_data 申请信息
  34. * @param unknown $cert_data 认证信息
  35. * @param unknown $user_info 用户信息(必传字段 username password(加密过后的) member_id app_module(shop))
  36. */
  37. public function apply($apply_data, $cert_data)
  38. {
  39. model('shop_apply')->startTrans();
  40. try {
  41. $uid = isset($apply_data['uid']) ? $apply_data['uid'] : 0;
  42. //添加申请信息
  43. $apply_money = $this->getApplyMoney($apply_data['apply_year'], $apply_data['group_id'], $apply_data['category_id']);
  44. $apply_data['paying_deposit'] = $apply_money['code']['paying_deposit'];
  45. $apply_data['paying_apply'] = $apply_money['code']['paying_apply'];
  46. $apply_data['paying_amount'] = $apply_money['code']['paying_amount'];
  47. $apply_data['create_time'] = time();
  48. $apply_data['apply_no'] = date('YmdHi').rand(1111,9999);
  49. $apply_data['apply_state'] = 1;
  50. //获取商家申请信息
  51. $apply_info = model('shop_apply')->getInfo([ [ 'uid', '=', $uid ] ]);
  52. if($apply_info){
  53. //判断认证信息是否存在
  54. if($apply_info['cert_id'] == 0){
  55. //添加认证信息
  56. $cert_id = model('shop_cert')->add($cert_data);
  57. //添加申请信息
  58. $apply_data['cert_id'] = $cert_id;
  59. $res = model('shop_apply')->update($apply_data,[[ 'uid', '=', $uid ]]);
  60. }else{
  61. $res = model('shop_apply')->update($apply_data,[[ 'uid', '=', $uid ]]);
  62. //修改认证信息
  63. model('shop_cert')->update($cert_data,[['cert_id','=',$apply_info['cert_id']]]);
  64. }
  65. }else{
  66. //添加认证信息
  67. $cert_id = model('shop_cert')->add($cert_data);
  68. //添加申请信息
  69. $apply_data['cert_id'] = $cert_id;
  70. $res = model('shop_apply')->add($apply_data);
  71. }
  72. model('shop_apply')->commit();
  73. return $this->success($res);
  74. } catch (\Exception $e) {
  75. model('shop_apply')->rollback();
  76. return $this->error('', $e->getMessage());
  77. }
  78. }
  79. /**
  80. * 获取申请金额
  81. * @param unknown $apply_year
  82. * @param unknown $group_id
  83. * @param unknown $category_id
  84. */
  85. public function getApplyMoney($apply_year, $group_id, $category_id)
  86. {
  87. $shop_group = new ShopGroup();
  88. $group_info = $shop_group->getGroupInfo([['group_id', '=', $group_id]], 'fee');
  89. $shop_category = new ShopCategory();
  90. $category_info = $shop_category->getCategoryInfo([['category_id', '=', $category_id]], 'baozheng_money');
  91. $money = [
  92. 'paying_deposit' => $category_info['data']['baozheng_money'],
  93. 'paying_apply' => number_format($group_info['data']['fee']*$apply_year,2, '.' , ''),
  94. 'paying_amount' => number_format($category_info['data']['baozheng_money'] + $group_info['data']['fee']*$apply_year,2, '.' , '')
  95. ];
  96. return success($money);
  97. }
  98. /**
  99. * 查询申请完整信息
  100. * @param unknown $condition
  101. */
  102. public function getApplyDetail($condition)
  103. {
  104. $field = 'nsa.apply_id, nsa.site_id,nsa.website_id, nsa.member_id, nsa.username, nsa.cert_id, nsa.shop_name, nsa.apply_state,
  105. nsa.apply_message, nsa.apply_year, nsa.category_name, nsa.category_id, nsa.group_name, nsa.group_id,
  106. nsa.paying_money_certificate, nsa.paying_money_certificate_explain, nsa.paying_deposit, nsa.paying_apply,
  107. nsa.paying_amount, nsa.create_time, nsa.audit_time, nsa.finish_time,
  108. nsc.cert_id, nsc.cert_type, nsc.company_name, nsc.company_province_id, nsc.company_city_id, nsc.company_district_id,
  109. nsc.company_address, nsc.contacts_name, nsc.contacts_mobile, nsc.contacts_card_no, nsc.contacts_card_electronic_1,
  110. nsc.contacts_card_electronic_2, nsc.contacts_card_electronic_3, nsc.business_licence_number,
  111. nsc.business_licence_number_electronic, nsc.business_sphere, nsc.taxpayer_id, nsc.general_taxpayer,
  112. nsc.tax_registration_certificate, nsc.tax_registration_certificate_electronic, nsc.bank_account_name,
  113. nsc.bank_account_number, nsc.bank_name, nsc.bank_address, nsc.bank_code, nsc.bank_type, nsc.settlement_bank_account_name,
  114. nsc.settlement_bank_account_number, nsc.settlement_bank_name, nsc.settlement_bank_address,nsc.company_full_address,
  115. w.site_area_name';
  116. $alias = 'nsa';
  117. $join = [
  118. [
  119. 'shop_cert nsc',
  120. 'nsa.cert_id = nsc.cert_id',
  121. 'left'
  122. ],
  123. [
  124. 'website w',
  125. 'w.site_id = nsa.website_id',
  126. 'left'
  127. ],
  128. ];
  129. $info = model('shop_apply')->getInfo($condition, $field, $alias, $join);
  130. return $this->success($info);
  131. }
  132. /**
  133. * 获取申请信息(不包含认证信息)
  134. * @param unknown $condition
  135. * @param unknown $field
  136. */
  137. public function getApplyInfo($condition, $field = '*')
  138. {
  139. $info = model('shop_apply')->getInfo($condition, $field);
  140. return $this->success($info);
  141. }
  142. /**
  143. * 获取店铺申请列表
  144. * @param array $condition
  145. * @param string $field
  146. * @param string $order
  147. * @param string $limit
  148. */
  149. public function getApplyList($condition = [], $field = '*', $order = '', $limit = null)
  150. {
  151. $list = model('shop_apply')->getList($condition, $field, $order, '', '', '', $limit);
  152. return $this->success($list);
  153. }
  154. /**
  155. * 获取店铺申请分页列表
  156. * @param array $condition
  157. * @param number $page
  158. * @param string $page_size
  159. * @param string $order
  160. * @param string $field
  161. */
  162. public function getApplyPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*')
  163. {
  164. $list = model('shop_apply')->pageList($condition, $field, $order, $page, $page_size);
  165. return $this->success($list);
  166. }
  167. /**
  168. * 修改店铺申请
  169. * @param array $data
  170. */
  171. public function editApply($data, $condition)
  172. {
  173. $res = model('shop_apply')->update($data, $condition);
  174. return $this->success($res);
  175. }
  176. /**
  177. * 审核通过
  178. * @param unknown $apply_id
  179. */
  180. public function applyPass($apply_id)
  181. {
  182. $res = model('shop_apply')->update([ 'apply_state' => 2, 'audit_time' => time() ], [ [ 'apply_id', '=', $apply_id ] ]);
  183. return $this->success($res);
  184. }
  185. /**
  186. * 审核拒绝
  187. * @param unknown $apply_id
  188. * @param unknown $reason
  189. */
  190. public function applyReject($apply_id, $reason)
  191. {
  192. $res = model('shop_apply')->update([ 'apply_state' => -1, 'apply_message' => $reason ], [ [ 'apply_id', '=', $apply_id ] ]);
  193. return $this->success($res);
  194. }
  195. /**
  196. * 支付凭证(上传)
  197. * @param unknown $data
  198. * @param unknown $apply_id
  199. */
  200. public function pay($data, $apply_id)
  201. {
  202. $res = model('shop_apply')->update($data, [ [ 'apply_id', '=', $apply_id ] ]);
  203. return $this->success($res);
  204. }
  205. /**
  206. * 入驻通过
  207. * @param $apply_id
  208. * @param $apply_message
  209. * @return array
  210. */
  211. public function openShop($apply_id,$apply_message='')
  212. {
  213. //检测店铺是否已存在
  214. $apply_info = model('shop_apply')->getInfo([ [ 'apply_id', '=', $apply_id ] ]);
  215. if ($apply_info['site_id'] != 0) {
  216. $shop_info = model("shop")->getInfo([ [ 'site_id', '=', $apply_info['site_id'] ] ]);
  217. if ($shop_info['cert_id'] == 0) {
  218. $res = $this->certOpenShop($apply_id,$apply_message);
  219. return $res;
  220. }else{
  221. model('shop_apply')->rollback();
  222. return $this->error('', 'SHOP_EXISTED');
  223. }
  224. }
  225. model('shop_apply')->startTrans();
  226. try {
  227. //添加系统站
  228. $site_id = model("site")->add([ 'site_type' => 'shop' ]);
  229. //获取用户账户信息
  230. $user_info = model('user')->getInfo([ ['uid','=',$apply_info['uid']] ],'username');
  231. //添加店铺
  232. $shop_data = [
  233. 'site_id' => $site_id,
  234. 'site_name' => $apply_info['shop_name'],
  235. 'username' => $user_info['username'],
  236. 'expire_time' => time() + 365 * 24 * 3600 * $apply_info['apply_year'],
  237. 'website_id' => $apply_info['website_id'],
  238. 'level_id' => $apply_info['level_id'],
  239. 'level_name' => $apply_info['level_name'],
  240. 'group_id' => $apply_info['group_id'],
  241. 'group_name' => $apply_info['group_name'],
  242. 'category_id' => $apply_info['category_id'],
  243. 'category_name' => $apply_info['category_name'],
  244. 'member_id' => $apply_info['uid'],
  245. 'member_name' => $apply_info['member_name'],
  246. 'cert_id' => $apply_info['cert_id'],
  247. 'shop_baozhrmb' => $apply_info['paying_deposit'],
  248. 'shop_open_fee' => $apply_info['paying_apply'],
  249. 'create_time' => time()
  250. ];
  251. model("shop")->add($shop_data);
  252. //点击支付保证金凭据
  253. if ($apply_info['paying_deposit'] > 0) {
  254. $data_deposit = [
  255. 'deposit_no' => date('YmdHi').rand(1111,9999),
  256. 'site_id' => $site_id,
  257. 'site_name' => $apply_info['shop_name'],
  258. 'money' => $apply_info['paying_deposit'],
  259. 'pay_certificate' => $apply_info['paying_money_certificate'],
  260. 'pay_certificate_explain' => $apply_info['paying_money_certificate_explain'],
  261. 'remark' => '入驻支付保证金',
  262. 'status' => 1,
  263. 'create_time' => time(),
  264. 'audit_time' => time()
  265. ];
  266. model("shop_deposit")->add($data_deposit);
  267. }
  268. //添加入驻费用流水
  269. if($apply_info['paying_apply'] > 0){
  270. if($apply_info['website_id'] > 0){
  271. //获取分站信息
  272. $website_model = new WebSite();
  273. $website_info = $website_model->getWebSite([ ['site_id','=',$apply_info['website_id']] ],'site_area_name,shop_rate');
  274. $website_name = $website_info['data']['site_area_name'];
  275. if(isset($website_info['data']['shop_rate']) && $website_info['data']['shop_rate'] > 0){
  276. $website_commission = floor($apply_info['paying_apply']*$website_info['data']['shop_rate'])/100;
  277. //增加店铺费用
  278. model('website')->setInc([ ['site_id','=',$apply_info['website_id']] ],'account_shop',$website_commission);
  279. //添加分站账户流水记录
  280. $website_model->addWebsiteAccount($apply_info['website_id'],'account', $website_commission, "shop", $apply_info['site_id'], '店铺入驻,账单编号'.$apply_info['apply_no']);
  281. }else{
  282. $website_commission = 0;
  283. }
  284. }else{
  285. $website_name = '全国';
  286. $website_commission = $apply_info['paying_apply'];
  287. }
  288. $open_shop_data = [
  289. 'account_no' => $apply_info['apply_no'],
  290. 'site_id' => $site_id,
  291. 'site_name' => $apply_info['shop_name'],
  292. 'money' => $apply_info['paying_apply'],
  293. 'type' => 1,
  294. 'type_name' => '店铺入驻费用',
  295. 'relate_id' => $apply_info['apply_id'],
  296. 'create_time' => time(),
  297. 'website_id' => $apply_info['website_id'],
  298. 'website_name' => $website_name,
  299. 'website_commission' => $website_commission
  300. ];
  301. model('shop_open_account')->add($open_shop_data);
  302. }
  303. //添加系统用户组
  304. $group = new Group();
  305. $group_data = [
  306. 'site_id' => $site_id,
  307. 'app_module' => 'shop',
  308. 'group_name' => '管理员组',
  309. 'is_system' => 1,
  310. 'create_time' => time()
  311. ];
  312. $group_id = $group->addGroup($group_data)['data'];
  313. //更新管理员信息
  314. model("user")->update(
  315. [ 'group_id' => $group_id,'group_name' => '管理员组', 'site_id' => $site_id, 'app_group' => $apply_info['group_id'] ],
  316. [ [ 'uid', '=', $apply_info['uid'] ], [ 'app_module', '=', 'shop' ] ]);
  317. //更新认证信息
  318. model("shop_cert")->update([ 'site_id' => $site_id ], [ [ 'cert_id', '=', $apply_info['cert_id'] ] ]);
  319. model("shop_apply")->update([ 'apply_state' => 3, 'site_id' => $site_id,'apply_message'=>$apply_message ], [ [ 'apply_id', '=', $apply_id ] ]);
  320. // 添加店铺相册默认分组
  321. model("album")->add(['site_id' => $site_id, 'album_name' => "默认分组", 'update_time' => time(), 'is_default' => 1]);
  322. //执行事件
  323. event("AddShop", [ 'site_id' => $site_id ]);
  324. model('shop_apply')->commit();
  325. $config_model = new ConfigModel();
  326. $is_use = 1;
  327. $config_model->setExpressConfig([], $is_use,$site_id );
  328. return $this->success($site_id);
  329. } catch (\Exception $e) {
  330. model('shop_apply')->rollback();
  331. return $this->error('', $e->getMessage());
  332. }
  333. }
  334. /**
  335. * 获取店铺申请状态
  336. */
  337. public function getApplyState()
  338. {
  339. return $this->apply_state;
  340. }
  341. /**
  342. * 体验入驻
  343. * @param $shop_data
  344. * @param $user_info
  345. */
  346. public function experienceApply($shop_data,$user_info)
  347. {
  348. model('shop')->startTrans();
  349. try {
  350. //检测店铺名否已存在
  351. $shop_count = model("shop")->getCount([ [ 'site_name', '=', $shop_data['site_name'] ] ]);
  352. if ($shop_count > 0) {
  353. model('shop')->rollback();
  354. return $this->error('', 'SHOP_EXISTED');
  355. }
  356. //检测用户是否已经入驻
  357. $user = model('user')->getInfo([[ 'uid','=',$user_info['uid'] ],['app_module','=','shop']],'site_id');
  358. if($user['site_id'] != 0){
  359. model('shop')->rollback();
  360. return $this->error('', '请不要重复入驻');
  361. }
  362. //添加系统站
  363. $site_id = model("site")->add([ 'site_type' => 'shop' ]);
  364. //获取店铺体验入驻设置
  365. $config_model = new ShopaccountModel();
  366. $config = $config_model->getShopWithdrawConfig();
  367. $config_info = $config['data']['value'];
  368. //获取店铺等级
  369. $group_name = model('shop_group')->getInfo([['group_id','=',$config_info['group_id']]],'group_name');
  370. //添加店铺
  371. $data = [
  372. 'site_id' => $site_id,
  373. 'website_id' => $shop_data['website_id'],
  374. 'site_name' => $shop_data['site_name'],
  375. 'username' => $user_info['username'],
  376. 'expire_time' => strtotime("+".$config_info['expire_time']."days",time()),
  377. 'category_id' => $shop_data['category_id'],
  378. 'category_name' => $shop_data['category_name'],
  379. 'group_id' => $config_info['group_id'],
  380. 'group_name' => $group_name['group_name'],
  381. 'create_time' => time()
  382. ];
  383. model("shop")->add($data);
  384. //添加店铺申请
  385. // $shop_apply_data = [
  386. // 'site_id' => $site_id,
  387. // 'shop_name' => $shop_data['site_name'],
  388. // 'username' => $user_info['username'],
  389. // 'apply_state' => 3,
  390. // 'category_id' => $shop_data['category_id'],
  391. // 'category_name' => $shop_data['category_name'],
  392. // 'group_id' => $config_info['group_id'],
  393. // 'group_name' => $group_name['group_name'],
  394. // 'create_time' => time(),
  395. // 'audit_time' => time(),
  396. // 'finish_time' => time(),
  397. // 'uid' => $user_info['uid']
  398. // ];
  399. //
  400. // model("shop_apply")->add($shop_apply_data);
  401. //添加系统用户组
  402. $group = new Group();
  403. $group_data = [
  404. 'site_id' => $site_id,
  405. 'app_module' => 'shop',
  406. 'group_name' => '管理员组',
  407. 'is_system' => 1,
  408. 'create_time' => time()
  409. ];
  410. $group_id = $group->addGroup($group_data)['data'];
  411. //更新管理员信息
  412. model("user")->update(
  413. [ 'group_id' => $group_id,'group_name' => '管理员组', 'site_id' => $site_id, 'app_group' => $config_info['group_id'] ],
  414. [ [ 'uid', '=', $user_info['uid'] ], [ 'app_module', '=', 'shop' ] ]);
  415. // 添加店铺相册默认分组
  416. model("album")->add(['site_id' => $site_id, 'album_name' => "默认分组", 'update_time' => time(), 'is_default' => 1]);
  417. //执行事件
  418. event("AddShop", [ 'site_id' => $site_id ]);
  419. model('shop')->commit();
  420. $config_model = new ConfigModel();
  421. $is_use = 1;
  422. $config_model->setExpressConfig([], $is_use,$site_id );
  423. return $this->success($site_id);
  424. } catch (\Exception $e) {
  425. model('shop')->rollback();
  426. return $this->error('', $e->getMessage());
  427. }
  428. }
  429. /**
  430. * 认证入驻通过
  431. * @param $apply_id
  432. * @param $apply_message
  433. * @return array
  434. */
  435. public function certOpenShop($apply_id,$apply_message = '')
  436. {
  437. model('shop_apply')->startTrans();
  438. try {
  439. $apply_info = model('shop_apply')->getInfo([ [ 'apply_id', '=', $apply_id ] ]);
  440. if ($apply_info['apply_state'] == 3) {
  441. model('shop_apply')->rollback();
  442. return $this->success();
  443. }
  444. //修改店铺信息
  445. $shop_data = [
  446. 'expire_time' => strtotime('+'.$apply_info['apply_year'].'year',time()),
  447. 'website_id' => $apply_info['website_id'],
  448. 'level_id' => $apply_info['level_id'],
  449. 'level_name' => $apply_info['level_name'],
  450. 'group_id' => $apply_info['group_id'],
  451. 'group_name' => $apply_info['group_name'],
  452. 'member_id' => $apply_info['uid'],
  453. 'member_name' => $apply_info['member_name'],
  454. 'cert_id' => $apply_info['cert_id'],
  455. 'shop_baozhrmb' => $apply_info['paying_deposit'],
  456. 'shop_open_fee' => $apply_info['paying_apply']
  457. ];
  458. model("shop")->update($shop_data,[ ['site_id','=',$apply_info['site_id']] ]);
  459. //点击支付保证金凭据
  460. if ($apply_info['paying_deposit'] > 0) {
  461. $data_deposit = [
  462. 'deposit_no' => date('YmdHi').rand(1111,9999),
  463. 'site_id' => $apply_info['site_id'],
  464. 'site_name' => $apply_info['shop_name'],
  465. 'money' => $apply_info['paying_deposit'],
  466. 'pay_certificate' => $apply_info['paying_money_certificate'],
  467. 'pay_certificate_explain' => $apply_info['paying_money_certificate_explain'],
  468. 'remark' => '入驻支付保证金',
  469. 'status' => 1,
  470. 'create_time' => time(),
  471. 'audit_time' => time()
  472. ];
  473. model("shop_deposit")->add($data_deposit);
  474. }
  475. //添加入驻费用流水
  476. if($apply_info['paying_apply'] > 0){
  477. if($apply_info['website_id'] > 0){
  478. //获取分站信息
  479. $website_model = new WebSite();
  480. $website_info = $website_model->getWebSite([ ['site_id','=',$apply_info['website_id']] ],'site_area_name,shop_rate');
  481. $website_name = $website_info['data']['site_area_name'];
  482. if($website_info['data']['shop_rate'] > 0){
  483. $website_commission = floor($apply_info['paying_apply']*$website_info['data']['shop_rate'])/100;
  484. }else{
  485. $website_commission = 0;
  486. }
  487. }else{
  488. $website_name = '全国';
  489. $website_commission = $apply_info['paying_apply'];
  490. }
  491. $open_shop_data = [
  492. 'account_no' => $apply_info['apply_no'],
  493. 'site_id' => $apply_info['site_id'],
  494. 'site_name' => $apply_info['shop_name'],
  495. 'money' => $apply_info['paying_apply'],
  496. 'type' => 1,
  497. 'type_name' => '店铺入驻费用',
  498. 'relate_id' => $apply_info['apply_id'],
  499. 'create_time' => time(),
  500. 'website_id' => $apply_info['website_id'],
  501. 'website_name' => $website_name,
  502. 'website_commission' => $website_commission
  503. ];
  504. model('shop_open_account')->add($open_shop_data);
  505. }
  506. //更新管理员信息
  507. model("user")->update(
  508. [ 'app_group' => $apply_info['group_id'] ],
  509. [ [ 'uid', '=', $apply_info['uid'] ], [ 'app_module', '=', 'shop' ] ]
  510. );
  511. $res = model("shop_apply")->update([ 'apply_state' => 3,'apply_message'=>$apply_message ], [ [ 'apply_id', '=', $apply_id ] ]);
  512. model('shop_cert')->update(['site_id'=>$apply_info['site_id']],[[ 'cert_id','=',$apply_info['cert_id']]]);
  513. //执行事件
  514. model('shop_apply')->commit();
  515. return $this->success($res);
  516. } catch (\Exception $e) {
  517. model('shop_apply')->rollback();
  518. return $this->error('', $e->getMessage());
  519. }
  520. }
  521. /**
  522. * 获取申请店铺数
  523. * @param array $condition
  524. */
  525. public function getShopApplyCount($condition = [])
  526. {
  527. $res = model('shop_apply')->getCount($condition);
  528. return $this->success($res);
  529. }
  530. public function suppShopApplyCount($condition = [])
  531. {
  532. $time = strtotime('today');
  533. $res = model('supplier_examine')->getInfo([['create_time','>=',$time]],'COUNT(id) shop_apply_count');
  534. return $this->success($res);
  535. }
  536. }