Manage.php 853 B

123456789101112131415161718192021222324252627
  1. <?php namespace Seller\Lib;
  2. use Dever;
  3. use Dever\Helper\Str;
  4. use Manage\Lib\Auth;
  5. class Manage extends Auth
  6. {
  7. # 获取商户列表
  8. public function getInfo()
  9. {
  10. return Dever::db('info', 'seller')->select(array('status' => 1))->fetchAll();
  11. }
  12. # 为商户生成appkey
  13. public function createAppKey($data)
  14. {
  15. $info = Dever::db('info', 'seller')->find($data['id']);
  16. if (!$info['appkey']) {
  17. $update['appkey'] = 'app' . Str::rand(15, 0);
  18. $update['appsecret'] = strtoupper(Str::rand(32));
  19. $check = Dever::db('info', 'seller')->find(array('appkey' => $update['appkey']));
  20. if ($check) {
  21. return $this->createAppKey($data);
  22. }
  23. Dever::db('info', 'seller')->update($data['id'], $update);
  24. }
  25. }
  26. }