| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- /**
- * @package merchant
- *
- * @author Qinii
- * @day 2020-06-15
- *
- *
- */
- namespace app\controller\admin\system\merchant;
- use app\common\repositories\merchant\order\OrderGzcRepository;
- use app\common\repositories\merchant\order\OrderMerchantRepository;
- use crmeb\basic\BaseController;
- use app\common\repositories\store\ExcelRepository;
- use think\App;
- use think\facade\Db;
- class GzcLogs extends BaseController
- {
- protected $repository;
- public function __construct(App $app, OrderGzcRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- public function lst()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['keyword', 'date', 'status', 'account']);
- return app('json')->success($this->repository->getList($where, $page, $limit));
- }
- /**
- * 入账表单
- * author: php迷途小书童
- * created: 2021/3/24 13:56
- */
- public function inForm()
- {
- return app('json')->success(formToData($this->repository->inForm()));
- }
- /**
- * 编辑表单
- * @param $id
- * author: php迷途小书童
- * created: 2021/3/24 15:21
- */
- public function editForm($id)
- {
- return app('json')->success(formToData($this->repository->editForm($id)));
- }
- /**
- * 编辑处理
- * author: php迷途小书童
- * created: 2021/3/24 15:22
- */
- public function editFormPost()
- {
- $params = $this->request->params(['id', 'user_name', 'mobile', 'user_card', 'bank_name', 'branch_name', 'bank_account', 'bank_no', 'alipay_account','alipay_no','wxpay_account','wxpay_no','deposit_dt']);
- Db::table('rrx_gzc_logs')
- ->update($params);
- return app('json')->success('编辑成功');
- }
- /**
- * 发起入账
- * author: php迷途小书童
- * created: 2021/3/24 13:56
- */
- public function inGzc()
- {
- return app('json')->fail('不可执行');
- $params = $this->request->params(['account_type', 'bank_name', 'branch_name', 'bank_account', 'bank_no', 'alipay_account','alipay_no','wxpay_account','wxpay_no','deposit_dt']);
- Db::table('rrx_gzc_logs')
- ->where('gzc', 0)
- ->where('pension', '>', 0)
- ->update($params);
- $cursor = Db::table('rrx_gzc_logs')
- ->where('gzc', 0)
- ->where('pension', '>', 0)
- ->cursor();
- foreach($cursor as $log){
- if (!$log){
- return app('json')->fail('暂无记录');
- }
- $phone= Db::table('rrx_user')->where('uid',$log['uid'])->value('phone');
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $uid = $OrderGzcRepository->register($phone);
- $OrderGzcRepository->gzc($uid,$log['pension']);
- }
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- Db::table('rrx_gzc_logs')
- ->where('gzc', 0)
- ->where('pension', '>', 0)
- ->update([
- 'gzc' => 1,
- 'platform_no' => $orderId,
- 'update_time' => date('Y-m-d H:i:s')
- ]);
- return app('json')->success('发起成功');
- }
- /**
- * TODO 导出文件
- * @author Qinii
- * @day 2020-07-30
- */
- public function excel()
- {
- $where = $this->request->params(['type', 'date', 'mer_id','keywords','status','username','order_sn']);
- app()->make(ExcelRepository::class)->create($where, $this->request->adminId(), 'order',0);
- return app('json')->success('开始导出数据');
- }
- public function checkAmount(){
- $where = $this->request->params(['user_name', 'user_card']);
- $return = $this->repository->checkAmount($where);
- return app('json')->success($return);
- }
- }
|