Commit 84ec7bbd by 杨树贤

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

parent 3bdbee7f
......@@ -29,11 +29,11 @@ class IntegralBillsController extends Controller
public function create(Request $request)
{
$res = DB::table('integral_bills')->insert([
'user_id' => $request->user_id,
'integral_amount' => $request->integral_amount,
'integral_id' => $request->integral_id,
'status' => 1,
'add_time' => time(),
'user_id' => $request->user_id,
'amount' => $request->amount,
'integral_id' => $request->integral_id,
'status' => 1,
'add_time' => time(),
]);
if ($res) {
......@@ -47,11 +47,11 @@ class IntegralBillsController extends Controller
{
$res = DB::table('integral_bills')->where('id', $id)
->update([
'user_id' => $request->user_id,
'integral_amount' => $request->integral_amount,
'integral_id' => $request->integral_id,
'status' => 1,
'update_time' => time(),
'user_id' => $request->user_id,
'amount' => $request->amount,
'integral_id' => $request->integral_id,
'status' => 1,
'update_time' => time(),
]);
if ($res) {
return $this->Export(0, 'ok');
......
......@@ -8,6 +8,7 @@ use App\Http\Filters\IntegralFilter;
use App\Models\Integral;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class IntegralsController extends Controller
{
......@@ -36,11 +37,11 @@ class IntegralsController extends Controller
public function create(Request $request)
{
$res = DB::table('integrals')->insert([
'name' => $request->name,
'daily_limit' => $request->daily_limit,
'integral_amount' => $request->integral_amount,
'add_time' => time(),
'status' => $request->status,
'name' => $request->name,
'daily_limit' => $request->daily_limit,
'amount' => $request->amount,
'add_time' => time(),
'status' => $request->status,
]);
if ($res) {
......@@ -52,17 +53,28 @@ class IntegralsController extends Controller
public function update(Request $request, $id)
{
$data = array_merge($request->all(), ['update_time' => time()]);
$res = DB::table('integrals')->where('id', $id)
->update([
'name' => $request->name,
'daily_limit' => $request->daily_limit,
'amount' => $request->amount,
'update_time' => time(),
]);
->update($data);
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)
{
$ids = explode(',', trim($ids));
......
......@@ -25,6 +25,8 @@ $router->get('/integrals/{id}', 'IntegralsController@show');
$router->post('/integrals', 'IntegralsController@create');
$router->patch('/integrals/{id}', 'IntegralsController@update');
$router->delete('/integrals/{id}', 'IntegralsController@destroy');
$router->post('/integrals/batchUpdateStatus', 'IntegralsController@batchUpdateStatus');
//积分类型
$router->get('/integral_types', 'IntegralTypesController@index');
......
17171
\ No newline at end of file
17955
\ 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