添加订单列表查询

This commit is contained in:
luofei 2024-03-06 11:37:44 +08:00
parent 535177563a
commit 1200f624d7
3 changed files with 34 additions and 21 deletions

View File

@ -3,7 +3,9 @@
namespace app\controller\api;
use app\common\dao\store\consumption\CommissionDao;
use app\common\model\store\order\StoreOrder;
use crmeb\basic\BaseController;
use think\exception\ValidateException;
use think\facade\Log;
class Open extends BaseController
@ -18,19 +20,12 @@ class Open extends BaseController
*/
public function activityCommission()
{
$timestamp = $this->request->post('timestamp');
$data = $this->request->post('data');
$aes = new \AES();
$iv = !empty($timestamp) ? $aes->buildIv($timestamp) : '';
$decrypted = $aes->decrypt($data, $iv);
$decrypted = $this->decrypt();
Log::error('供销平台佣金回调:' . var_export($decrypted, true));
if (!empty($decrypted)) {
$storeConsumptionUserDao = new CommissionDao();
// "惠农供销,谱写数字新篇章"活动首单分润
$result = $storeConsumptionUserDao->firstOrderCommissionCallback($decrypted);
return app('json')->success($result);
}
return app('json')->fail('解密失败');
$storeConsumptionUserDao = new CommissionDao();
// "惠农供销,谱写数字新篇章"活动首单分润
$result = $storeConsumptionUserDao->firstOrderCommissionCallback($decrypted);
return app('json')->success($result);
}
@ -42,19 +37,37 @@ class Open extends BaseController
* @throws \think\db\exception\ModelNotFoundException
*/
public function refundCommission()
{
$decrypted = $this->decrypt();
Log::error('供销平台退佣金回调:' . var_export($decrypted, true));
$storeConsumptionUserDao = new CommissionDao();
$result = $storeConsumptionUserDao->refundByCallback($decrypted);
return app('json')->success($result);
}
public function orderList()
{
$pageIndex = $this->request->get('page', 1);
$pageSize = $this->request->get('page_size', 15);
$order = StoreOrder::whereIn('status', [0, 1, 2, 3])
->field('order_id,order_sn')
->limit($pageIndex, $pageSize)
->order('order_id', 'desc')
->select()->toArray();
return app('json')->success($order);
}
public function decrypt()
{
$timestamp = $this->request->post('timestamp');
$data = $this->request->post('data');
$aes = new \AES();
$iv = !empty($timestamp) ? $aes->buildIv($timestamp) : '';
$decrypted = $aes->decrypt($data, $iv);
Log::error('供销平台退佣金回调:' . var_export($decrypted, true));
if (!empty($decrypted)) {
$storeConsumptionUserDao = new CommissionDao();
$result = $storeConsumptionUserDao->refundByCallback($decrypted);
return app('json')->success($result);
if (empty($decrypted)) {
throw new ValidateException('解密失败');
}
return app('json')->fail('解密失败');
return $decrypted;
}
}
}

View File

@ -566,7 +566,6 @@ class User extends BaseController
[$page, $limit] = $this->getPage();
$userIds = UserModel::where('spread_uid', $this->user->uid)->column('uid');
$query = Merchant::whereIn('uid', $userIds)->where('is_del', 0);
$count = $query->count();
$merchants = $query->page($page, $limit)
->field('mer_id,mer_name,uid,real_name')
->select()->toArray();
@ -591,7 +590,7 @@ class User extends BaseController
$result[] = ['mer_id' => '', 'mer_name' => '', 'uid' => $userId, 'real_name' => '', 'sale_amount' => '0.00', 'buy_amount' => '0.00', 'status' => 0];
}
}
return app('json')->success(['count' => $count, 'list' => $result]);
return app('json')->success(['count' => count($userIds), 'list' => $result]);
}
}

View File

@ -660,6 +660,7 @@ Route::group('api/', function () {
Route::get('storeActivity/consumption', 'api.store.StoreActivity/consumption'); //消费金列表
Route::post('open/activityCommission', 'api.open/activityCommission'); //活动佣金回调
Route::post('open/refundCommission', 'api.open/refundCommission'); //活动佣金退款回调
Route::get('open/orderList', 'api.open/orderList'); //订单列表
})->middleware(UserTokenMiddleware::class, false);
//微信支付回调