|
@@ -4,7 +4,7 @@ namespace app\api\controller;
|
|
|
|
|
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\Config;
|
|
use app\common\model\Config;
|
|
|
-use app\common\model\MongyIn;
|
|
|
|
|
|
|
+use app\common\model\MoneyIn;
|
|
|
use app\common\model\Order AS OrderModel;
|
|
use app\common\model\Order AS OrderModel;
|
|
|
use app\common\model\User AS UserModel;
|
|
use app\common\model\User AS UserModel;
|
|
|
use think\Db;
|
|
use think\Db;
|
|
@@ -93,7 +93,7 @@ class Money extends Api
|
|
|
//写入
|
|
//写入
|
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
|
try {
|
|
try {
|
|
|
- (new MongyIn())->save($insert_data);
|
|
|
|
|
|
|
+ (new MoneyIn())->save($insert_data);
|
|
|
Db::commit();
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
$this->error($e->getMessage());
|
|
$this->error($e->getMessage());
|
|
@@ -102,38 +102,102 @@ class Money extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 订单列表
|
|
|
|
|
|
|
+ * 上传图片
|
|
|
* @return void
|
|
* @return void
|
|
|
* @throws \think\exception\DbException
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
*/
|
|
|
- public function list()
|
|
|
|
|
|
|
+ public function recharge_upload()
|
|
|
{
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
$user = $this->auth->getUser();
|
|
|
- $paginator = OrderModel::where('user_id', $user['id'])
|
|
|
|
|
- ->field('order_no,amount,bonus,status,create_time')
|
|
|
|
|
- ->order('id DESC')
|
|
|
|
|
- ->paginate($this->pageSize);
|
|
|
|
|
- foreach ($paginator as $k => $v) {
|
|
|
|
|
- $paginator[$k]['status_name'] = (new OrderModel())->getStatusNames($v['status']);
|
|
|
|
|
- }
|
|
|
|
|
- $res_data = $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items());
|
|
|
|
|
- $res_data['bonus_sum'] = $user['bonus_sum'];
|
|
|
|
|
- $this->success('', $res_data);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ $order_no = $this->request->post('order_no');
|
|
|
|
|
+ if (empty($order_no)) {
|
|
|
|
|
+ $this->error(__('参数有误'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $order_info = (new MoneyIn())
|
|
|
|
|
+ ->where('user_id', $user['id'])
|
|
|
|
|
+ ->where('order_no', $order_no)
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if (empty($order_no)) {
|
|
|
|
|
+ $this->error(__('参数有误'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $file_info = ali_oss_upload($this->request, 'recharge', $order_no);
|
|
|
|
|
+ if($file_info['code'] == 0){
|
|
|
|
|
+ $this->error($file_info['msg']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $this->success('', $file_info['data']);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
- * 获取订单
|
|
|
|
|
|
|
+ * 提交充值信息
|
|
|
* @return void
|
|
* @return void
|
|
|
* @throws \think\exception\DbException
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
*/
|
|
|
- public function get()
|
|
|
|
|
|
|
+ public function recharge_submit()
|
|
|
|
|
+ {
|
|
|
|
|
+ $user = $this->auth->getUser();
|
|
|
|
|
+
|
|
|
|
|
+ $order_no = $this->request->post('order_no');
|
|
|
|
|
+ $img_url = $this->request->post('img_url');
|
|
|
|
|
+
|
|
|
|
|
+ if (empty($order_no)) {
|
|
|
|
|
+ $this->error(__('参数有误'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (empty($img_url)) {
|
|
|
|
|
+ $this->error(__('参数有误'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $order_info = (new MoneyIn())
|
|
|
|
|
+ ->where('user_id', $user['id'])
|
|
|
|
|
+ ->where('order_no', $order_no)
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ if (empty($order_info)) {
|
|
|
|
|
+ $this->error(__('参数有误'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($order_info['status'] != 0) {
|
|
|
|
|
+ if (empty($order_info['img_url'])) {
|
|
|
|
|
+ (new MoneyIn())
|
|
|
|
|
+ ->where('order_no', $order_no)
|
|
|
|
|
+ ->update([
|
|
|
|
|
+ 'img_url' => $img_url
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success(__('提交成功'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ (new MoneyIn())
|
|
|
|
|
+ ->where('order_no', $order_no)
|
|
|
|
|
+ ->update([
|
|
|
|
|
+ 'img_url' => $img_url,
|
|
|
|
|
+ 'status' => 1,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $this->success(__('提交成功'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提现
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ public function withdraw()
|
|
|
{
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
$user = $this->auth->getUser();
|
|
|
|
|
|
|
|
- $data['order_no'] = 'sn45784545';
|
|
|
|
|
- $data['title'] = '商品标题111';
|
|
|
|
|
- $data['amount'] = 4545;
|
|
|
|
|
- $data['bonus'] = $user['bonus_sum'];
|
|
|
|
|
|
|
+ $data['balance'] = $user['balance'];
|
|
|
|
|
+ $data['usdt'] = $data['bank'] = 1;
|
|
|
|
|
+ $recharge_info = UserModel::getAgentInfoByAgentId($user['agent_id']);
|
|
|
|
|
+ if(empty($recharge_info)){
|
|
|
|
|
+ $this->error(__('无充值信息'));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(empty($recharge_info['usdt'])){
|
|
|
|
|
+ $data['usdt'] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(empty($recharge_info['bank'])){
|
|
|
|
|
+ $data['bank'] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
$this->success('', $data);
|
|
$this->success('', $data);
|
|
|
}
|
|
}
|