123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- namespace app\api\controller\auction;
- use app\models\auction\Auction;
- use app\models\auction\AuctionApply;
- use app\models\auction\AuctionBooking;
- use app\models\auction\AuctionGu;
- use app\models\auction\AuctionOrder;
- use app\models\auction\AuctionPay;
- use app\models\auction\AuctionProduct;
- use app\models\auction\AuctionTime;
- use app\models\user\User;
- use app\models\user\UserBill;
- use app\Request;
- use Monolog\Handler\Curl\Util;
- use think\facade\Cache;
- use crmeb\services\{
- CacheService,
- ExpressService,
- SystemConfigService
- };
- use crmeb\services\UtilService;
- use crmeb\repositories\OrderRepository;
- use think\facade\Db;
- use think\facade\Validate;
- class AuctionOrderController
- {
- /**
- * 申诉
- * @param Request $request
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function plead(Request $request)
- {
- $data = UtilService::postMore([
- 'order_id'
- ]);
- $order = AuctionOrder::where([['order_id', '=', $data['order_id']], ['collection_id', '=', $request->uid()]])->find();
- if ($order['appeal'] == 1) return app('json')->fail('该订单已在申诉中');// 失败
- if (!$order) return app('json')->fail('没有订单');// 失败
- $product = AuctionProduct::where('id', $order['product_id'])->find();
- $product['is_show'] = 0;//下架
- $product['frozen'] = 1; // 冻结
- $order['appeal'] = 1;// 申诉
- $order['is_gs'] = 0;
- $order->save();
- $product->save();
- AuctionTime::where([ ['product_id', '=', $product['id']], ['uid', '=', $request->uid()]])->delete();
- return app('json')->success('申诉成功');// 失败
- }
- /**
- * 撤销申诉
- * @param Request $request
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function revoke(Request $request)
- {
- $data = UtilService::postMore([
- 'order_id'
- ]);
- $order = AuctionOrder::where([['order_id', '=', $data['order_id']], ['collection_id', '=', $request->uid()]])->find();
- if ($order['appeal'] == 0) return app('json')->fail('该订单未申诉');// 失败
- if (!$order) return app('json')->fail('没有订单');// 失败
- $product = AuctionProduct::where('id', $order['product_id'])->find();
- $product['frozen'] = 0;
- $order['appeal'] = 0;// 撤销申诉
- $order->save();
- $product->save();
- return app('json')->success('撤销申诉成功');// 失败
- }
- /**
- * 修改支付凭证
- * @param Request $request
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function edit_voucher(Request $request)
- {
- $data = UtilService::getMore([
- ['order_id'],
- ['image']
- ]);
- if (!$data['image'] || !$data['order_id']) return app('json')->fail('请上传打款凭证');
- $order = AuctionOrder::where('order_id', $data['order_id'])->find();
- if (!$order) return app('json')->fail('订单不存在');
- if ($order['status'] == 3) return app('json')->fail('当前订单已完成');
- $auction = Auction::where('id', $order['auction_id'])->find();
- if (strtotime($auction['radd_time']) > time() or strtotime($auction['rend_time']) < time()) return app('json')->fail('未到支付时间,支付时间为'.$auction['radd_time'].'-'.$auction['rend_time']);
- $order['upload_image'] = $data['image'];
- $order['status'] = 2;
- $order['voucher_time'] = time();
- if ($order->save()){
- return app('json')->successful('上传成功');
- }else{
- return app('json')->fail('上传失败');
- }
- }
- }
|