diff --git a/Laravel/app/Http/Controllers/API/Admin/ConfigController.php b/Laravel/app/Http/Controllers/API/Admin/ConfigController.php
index a26cd1e..4afbd78 100644
--- a/Laravel/app/Http/Controllers/API/Admin/ConfigController.php
+++ b/Laravel/app/Http/Controllers/API/Admin/ConfigController.php
@@ -18,7 +18,7 @@ class ConfigController extends Controller
$is_admin=true;
}
$configs = new ConfigService();
- return $configs->GetConfigInfo(['站点名称','站点图片'],$is_admin);
+ return $configs->GetConfigInfo(['站点名称','站点图片','撤销转赠权限'],$is_admin);
}
public function SaveConfig(){
diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/TransferCodeController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/TransferCodeController.php
new file mode 100644
index 0000000..f1d1e24
--- /dev/null
+++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/TransferCodeController.php
@@ -0,0 +1,55 @@
+get('userid');//中间件产生的参数
+ $group=$request->get('role');
+ $code_id = request('code_id');
+ $order_id = request('order_id');
+ $config=DB::table('configs')->where(['label'=>'撤销转赠权限'])->first();
+ $orderInfo=DB::table('orders')->where(['id'=>$order_id])->first();
+ if(!!$config){
+ $config->value= explode(',', $config->value);
+ if(in_array($group, $config->value)){
+ $code=DB::table('transfer_code')->where(['id'=>$code_id,'is_del'=>0,'status'=>1])->first();
+ if(!!$code){
+ if($code->link_order_id<>$order_id){
+ return \Yz::echoError1("订单id与转赠码关联不匹配");
+ }
+ DB::beginTransaction();
+ try {
+ $u_code=DB::table('transfer_code')->where(['id'=>$code_id])->update([
+ 'is_del'=>1,
+ ]);
+ $u_order=DB::table('orders')->where(['id'=>$order_id])->update([
+ 'status'=>2,
+ 'transfer_type'=>null,
+ 'transfer_link'=>null,
+ ]);
+ if($u_code&&$u_order){
+ DB::commit();
+ return \Yz::Return(true,'操作成功',['orderid'=>$order_id]);
+ }else{
+ DB::rollBack();
+ }
+ }catch ( \Exception $e ) {
+ DB::rollBack();
+ }
+
+
+ }else{
+ return \Yz::echoError1("未找到有效转赠码");
+ }
+
+ }else{
+ return \Yz::echoError1("暂无权限");
+ }
+ }
+ }
+}
diff --git a/Laravel/app/Services/ConfigService.php b/Laravel/app/Services/ConfigService.php
index 53b1f97..d657279 100644
--- a/Laravel/app/Services/ConfigService.php
+++ b/Laravel/app/Services/ConfigService.php
@@ -18,6 +18,9 @@ class ConfigService
if(count($q)>0) {
$result = [];
foreach ($q as $k => $v) {
+ if($v->label=='撤销转赠权限'){
+ $v->value= explode(',', $v->value);
+ }
$result[$v->label] = $v->value;
}
return \Yz::Return(true, '查询成功', $result);
diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php
index 7653062..079e525 100644
--- a/Laravel/routes/api.php
+++ b/Laravel/routes/api.php
@@ -141,6 +141,7 @@ Route::group(['middleware' => ['checktoken', 'log'], 'prefix' => 'v1'], function
Route::post('admin/QuestionExport', 'App\Http\Controllers\API\Admin\YeWu\QuestionLogController@Export');//导出回答
Route::post('admin/GetWorkUnitEnableList', 'App\Http\Controllers\API\Admin\YeWu\WorkUnitController@GetEnableList');//获取单位列表
+ Route::post('admin/CancelZhuanZengCode', 'App\Http\Controllers\API\Admin\YeWu\TransferCodeController@CancelZhuanZeng');//取消转赠
diff --git a/admin/src/api/api.js b/admin/src/api/api.js
index d07918a..ee582b2 100644
--- a/admin/src/api/api.js
+++ b/admin/src/api/api.js
@@ -459,4 +459,8 @@ export const ComboSaveOrder = (data = {}) => {
//获取单位可用列表
export const GetWorkUnitEnableList = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/GetWorkUnitEnableList`, data: data })
+}
+//取消转赠码
+export const CancelZhuanZengCode = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/CancelZhuanZengCode`, data: data })
}
\ No newline at end of file
diff --git a/admin/src/views/Index.vue b/admin/src/views/Index.vue
index b515ab5..435f3ad 100644
--- a/admin/src/views/Index.vue
+++ b/admin/src/views/Index.vue
@@ -202,6 +202,7 @@ watch(()=>router.currentRoute.value,(newVal,oldVal)=>{
if(res.status){
configInfo.value=res.data
configInfo.value.站点图片=import.meta.env.VITE_APP_FILE+configInfo.value.站点图片
+ sessionStorage.setItem('ConfigInfo',JSON.stringify(configInfo.value))
}
})
}
diff --git a/admin/src/views/OrderMngr/Order.vue b/admin/src/views/OrderMngr/Order.vue
index 448e300..5aae630 100644
--- a/admin/src/views/OrderMngr/Order.vue
+++ b/admin/src/views/OrderMngr/Order.vue
@@ -105,7 +105,10 @@
已完成
已退款
- 已转赠
+
+ 已转赠
+