Commit 84ec7bbd by 杨树贤

针对红包信息部分的后台进行相应的修改

parent 3bdbee7f
...@@ -29,11 +29,11 @@ class IntegralBillsController extends Controller ...@@ -29,11 +29,11 @@ class IntegralBillsController extends Controller
public function create(Request $request) public function create(Request $request)
{ {
$res = DB::table('integral_bills')->insert([ $res = DB::table('integral_bills')->insert([
'user_id' => $request->user_id, 'user_id' => $request->user_id,
'integral_amount' => $request->integral_amount, 'amount' => $request->amount,
'integral_id' => $request->integral_id, 'integral_id' => $request->integral_id,
'status' => 1, 'status' => 1,
'add_time' => time(), 'add_time' => time(),
]); ]);
if ($res) { if ($res) {
...@@ -47,11 +47,11 @@ class IntegralBillsController extends Controller ...@@ -47,11 +47,11 @@ class IntegralBillsController extends Controller
{ {
$res = DB::table('integral_bills')->where('id', $id) $res = DB::table('integral_bills')->where('id', $id)
->update([ ->update([
'user_id' => $request->user_id, 'user_id' => $request->user_id,
'integral_amount' => $request->integral_amount, 'amount' => $request->amount,
'integral_id' => $request->integral_id, 'integral_id' => $request->integral_id,
'status' => 1, 'status' => 1,
'update_time' => time(), 'update_time' => time(),
]); ]);
if ($res) { if ($res) {
return $this->Export(0, 'ok'); return $this->Export(0, 'ok');
......
...@@ -8,6 +8,7 @@ use App\Http\Filters\IntegralFilter; ...@@ -8,6 +8,7 @@ use App\Http\Filters\IntegralFilter;
use App\Models\Integral; use App\Models\Integral;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class IntegralsController extends Controller class IntegralsController extends Controller
{ {
...@@ -36,11 +37,11 @@ class IntegralsController extends Controller ...@@ -36,11 +37,11 @@ class IntegralsController extends Controller
public function create(Request $request) public function create(Request $request)
{ {
$res = DB::table('integrals')->insert([ $res = DB::table('integrals')->insert([
'name' => $request->name, 'name' => $request->name,
'daily_limit' => $request->daily_limit, 'daily_limit' => $request->daily_limit,
'integral_amount' => $request->integral_amount, 'amount' => $request->amount,
'add_time' => time(), 'add_time' => time(),
'status' => $request->status, 'status' => $request->status,
]); ]);
if ($res) { if ($res) {
...@@ -52,17 +53,28 @@ class IntegralsController extends Controller ...@@ -52,17 +53,28 @@ class IntegralsController extends Controller
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = array_merge($request->all(), ['update_time' => time()]);
$res = DB::table('integrals')->where('id', $id) $res = DB::table('integrals')->where('id', $id)
->update([ ->update($data);
'name' => $request->name,
'daily_limit' => $request->daily_limit,
'amount' => $request->amount,
'update_time' => time(),
]);
return $this->Export(0, 'ok'); return $this->Export(0, 'ok');
} }
public function batchUpdateStatus(Request $request)
{
$ids = $request->ids;
if (!is_array($ids)) {
return Log::Info('批量修改参数不是数组');
}
$status = $request->status;
$result = DB::table('integrals')
->whereIn('id', $ids)
->update(['status' => (int)$status]);
return $this->Export(0, 'ok');
// return $this->Export(033, '批量修改用户积分失败');
}
public function destroy($ids) public function destroy($ids)
{ {
$ids = explode(',', trim($ids)); $ids = explode(',', trim($ids));
......
...@@ -25,6 +25,8 @@ $router->get('/integrals/{id}', 'IntegralsController@show'); ...@@ -25,6 +25,8 @@ $router->get('/integrals/{id}', 'IntegralsController@show');
$router->post('/integrals', 'IntegralsController@create'); $router->post('/integrals', 'IntegralsController@create');
$router->patch('/integrals/{id}', 'IntegralsController@update'); $router->patch('/integrals/{id}', 'IntegralsController@update');
$router->delete('/integrals/{id}', 'IntegralsController@destroy'); $router->delete('/integrals/{id}', 'IntegralsController@destroy');
$router->post('/integrals/batchUpdateStatus', 'IntegralsController@batchUpdateStatus');
//积分类型 //积分类型
$router->get('/integral_types', 'IntegralTypesController@index'); $router->get('/integral_types', 'IntegralTypesController@index');
......
17171 17955
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment