SelffetchVerifierLogic.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\logic\selffetch_shop;
  20. use app\common\logic\BaseLogic;
  21. use app\common\model\SelffetchVerifier;
  22. use app\common\service\FileService;
  23. /**
  24. * 核销员逻辑层
  25. * Class SelffetchVerifierLogic
  26. * @package app\adminapi\logic\selffetch_shop
  27. */
  28. class SelffetchVerifierLogic extends BaseLogic
  29. {
  30. /**
  31. * @notes 添加核销员
  32. * @param $params
  33. * @return bool
  34. * @author ljj
  35. * @date 2021/8/11 7:24 下午
  36. */
  37. public function add($params)
  38. {
  39. $selffetch_verifier = new SelffetchVerifier;
  40. $selffetch_verifier->selffetch_shop_id = $params['selffetch_shop_id'];
  41. $selffetch_verifier->user_id = $params['user_id'];
  42. $selffetch_verifier->sn = create_number_sn((new SelffetchVerifier()),'sn',8);
  43. $selffetch_verifier->name = $params['name'];
  44. $selffetch_verifier->mobile = $params['mobile'];
  45. $selffetch_verifier->status = $params['status'];
  46. return $selffetch_verifier->save();
  47. }
  48. /**
  49. * @notes 编辑核销员
  50. * @param $params
  51. * @return bool
  52. * @throws \think\db\exception\DataNotFoundException
  53. * @throws \think\db\exception\DbException
  54. * @throws \think\db\exception\ModelNotFoundException
  55. * @author ljj
  56. * @date 2021/8/11 7:37 下午
  57. */
  58. public function edit($params)
  59. {
  60. $selffetch_verifier = SelffetchVerifier::find($params['id']);
  61. $selffetch_verifier->selffetch_shop_id = $params['selffetch_shop_id'];
  62. $selffetch_verifier->user_id = $params['user_id'];
  63. $selffetch_verifier->name = $params['name'];
  64. $selffetch_verifier->mobile = $params['mobile'];
  65. $selffetch_verifier->status = $params['status'];
  66. return $selffetch_verifier->save();
  67. }
  68. /**
  69. * @notes 核销员详情
  70. * @param $params
  71. * @return array
  72. * @throws \think\db\exception\DataNotFoundException
  73. * @throws \think\db\exception\DbException
  74. * @throws \think\db\exception\ModelNotFoundException
  75. * @author ljj
  76. * @date 2021/8/11 7:49 下午
  77. */
  78. public function detail($params)
  79. {
  80. $info = SelffetchVerifier::alias('sv')
  81. ->join('user u', 'sv.user_id = u.id')
  82. ->join('selffetch_shop ss', 'ss.id = sv.selffetch_shop_id')
  83. ->field('sv.*,u.nickname,u.avatar,ss.name as shop_name')
  84. ->where('sv.id',$params['id'])
  85. ->find()
  86. ->toArray();
  87. $info['avatar'] = trim($info['avatar']) ? FileService::getFileUrl($info['avatar']) : '';
  88. return $info;
  89. }
  90. /**
  91. * @notes 修改核销员状态
  92. * @param $params
  93. * @return bool
  94. * @throws \think\db\exception\DataNotFoundException
  95. * @throws \think\db\exception\DbException
  96. * @throws \think\db\exception\ModelNotFoundException
  97. * @author ljj
  98. * @date 2021/8/11 8:21 下午
  99. */
  100. public function status($params)
  101. {
  102. $selffetch_verifier = SelffetchVerifier::find($params['id']);
  103. $selffetch_verifier->status = $params['status'];
  104. return $selffetch_verifier->save();
  105. }
  106. /**
  107. * @notes 删除核销员
  108. * @param $params
  109. * @return bool
  110. * @author ljj
  111. * @date 2021/8/11 8:27 下午
  112. */
  113. public function del($params)
  114. {
  115. return SelffetchVerifier::destroy($params['id']);
  116. }
  117. }