UserEnter.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/11
  6. */
  7. namespace app\admin\controller\user;
  8. use app\admin\controller\AuthController;
  9. use crmeb\repositories\OrderRepository;
  10. use crmeb\repositories\ShortLetterRepositories;
  11. use crmeb\services\{ExpressService,
  12. JsonService,
  13. JsonService as Json,
  14. MiniProgramService,
  15. WechatService,
  16. FormBuilder as Form,
  17. CacheService,
  18. UtilService as Util};
  19. use app\admin\model\ump\StorePink;
  20. use crmeb\basic\BaseModel;
  21. use think\facade\Route as Url;
  22. use crmeb\services\YLYService;
  23. use think\facade\Log;
  24. use think\facade\Validate;
  25. /**
  26. * 订单管理控制器 同一个订单表放在一个控制器
  27. * Class StoreOrder
  28. * @package app\admin\controller\store
  29. */
  30. class UserEnter extends AuthController
  31. {
  32. /**
  33. * @return mixed
  34. */
  35. public function index()
  36. {
  37. return $this->fetch();
  38. }
  39. public function list()
  40. {
  41. $where = Util::getMore([
  42. ['status', ''],
  43. ['page', 1],
  44. ['limit', 20],
  45. ['stage', ''],
  46. ['order_id', ''],
  47. ['excel', 0],
  48. ['data', ''],
  49. ['many_id',''],
  50. ['name', '']
  51. ]);
  52. return Json::successlayui(\app\admin\model\user\UserEnter::list($where));
  53. }
  54. /**
  55. * 删除
  56. * @param $id
  57. * @return void
  58. * @throws \Exception
  59. */
  60. public function delete($id)
  61. {
  62. if (!$id) Json::fail('删除失败');
  63. $model = new \app\admin\model\user\UserEnter();
  64. $res = $model->where('id', $id)->delete();
  65. if ($res){
  66. return Json::success('删除成功!');
  67. }else{
  68. return Json::fail($model->getErrorInfo());
  69. }
  70. }
  71. /**
  72. * 审核通过
  73. * @param $id
  74. * @return void
  75. */
  76. public function tg($id)
  77. {
  78. if (!$id) Json::fail('通过失败');
  79. $model = new \app\admin\model\user\UserEnter();
  80. $details = $model->find($id);
  81. $details['status'] = 1;
  82. $res1 = \app\models\user\User::where('uid', $details['uid'])->update(['is_merchant' => 1]);
  83. $res2 = $details->save();
  84. if ($res1 && $res2){
  85. return Json::success('成功!');
  86. }else{
  87. return Json::fail($model->getErrorInfo());
  88. }
  89. }
  90. /**
  91. * 拒绝
  92. * @param $id
  93. * @return string
  94. * @throws \Exception
  95. */
  96. public function jj($id)
  97. {
  98. $f = [];
  99. $f[] = Form::textarea('fail_message', '不通过理由');
  100. $f[] = Form::hidden('id', $id);
  101. $form = Form::make_post_form('添加', $f, Url::buildUrl('jj_save'));
  102. $this->assign(compact('form'));
  103. return $this->fetch('public/form-builder');
  104. }
  105. /**
  106. * 不通过理由
  107. * @return void
  108. * @throws \think\db\exception\DataNotFoundException
  109. * @throws \think\db\exception\DbException
  110. * @throws \think\db\exception\ModelNotFoundException
  111. */
  112. public function jj_save()
  113. {
  114. $data = Util::postMore([
  115. ['id', ''],
  116. ['fail_message', '']
  117. ]);
  118. if (empty($data['fail_message'])) return Json::fail('填写拒绝理由');
  119. if (empty($data['id'])) return Json::fail('数据不存在');
  120. $details = \app\admin\model\user\UserEnter::find($data['id']);
  121. $details['fail_message'] = $data['fail_message'];
  122. $details['status'] = -1;
  123. if ($details->save()){
  124. return Json::success('成功!');
  125. }else{
  126. return Json::fail('失败');
  127. }
  128. }
  129. }