Commit 70167a82 authored by zw's avatar zw

1

parent f8ed4631
......@@ -93,11 +93,26 @@ class AccountBalanceService{
"user_phone" => $user_phone,
"money" => $money,
"status" => 0,
"user_name" => $user_name
"user_name" => $user_name,
"create_time" => date("Y-m-d H:i:s",time()),
"update_time" => date("Y-m-d H:i:s",time()),
);
$accountCheckModel = new UAccountCheck();
return $accountCheckModel->addCheck($arr);
}
public function check($id,$operator_id,$operator_name,$transfer_img,$status){
$arr = array(
"operator_id" => $operator_id,
"operator_name" => $operator_name,
"status" => $status,
"transfer_img" => $transfer_img,
"transfer_time" => date("Y-m-d H:i:s",time()),
"update_time" => date("Y-m-d H:i:s",time()),
);
$accountCheckModel = new UAccountCheck();
return $accountCheckModel->updateCheck($id,$arr);
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
use app\api\service\AccountBalanceService;
use app\index\extend\Basic;
use think\Request;
class AccountBalance extends Basic{
class AccountBalance extends Basic
{
private $s_account_balance;
public function __construct(Request $request = null)
......@@ -22,14 +24,14 @@ class AccountBalance extends Basic{
public function userAccountBalanceList()
{
$params = $this->params;
/* $params = array(
"create_time_start" => '2019-03-14 11:03:10',
"create_time_end" => '2019-03-15 11:03:10',
"user_phone" => '6471',
"user_id" => '111',
);*/
/* $params = array(
"create_time_start" => '2019-03-14 11:03:10',
"create_time_end" => '2019-03-15 11:03:10',
"user_phone" => '6471',
"user_id" => '111',
);*/
$data = $this->s_account_balance->getBalanceList($params);
if(count($data) <= 0){
if (count($data) <= 0) {
return $this->response("200", "null");
}
$result["list"] = $data;
......@@ -38,5 +40,39 @@ class AccountBalance extends Basic{
}
/**
* @return \think\Response
*/
public function check()
{
$params = $this->params;
/* $params = array(
"operator_id" => 1,
"operator_name" => "1231",
"transfer_img" => "123123",
"status" => 1,
"id" => 1
);*/
if (empty($params["operator_id"]) || empty($params["operator_name"]) || empty($params["id"]) || empty($params["transfer_img"])) {
return $this->response("101", "请求参数错误");
}
$id = $params["id"];
$operator_id = $params["operator_id"];
$operator_name = $params["operator_name"];
$transfer_img = $params["transfer_img"];
$status = $params["status"];
if (!$status && ($status != 1 || $status != 2)) {
return $this->response("101", "审核状态错误");
}
$id = $this->s_account_balance->check($id,$operator_id,$operator_name,$transfer_img,$status);
if($id > 0){
return $this->response("200","success");
}else{
return $this->response("101","error");
}
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
use think\Model;
......@@ -9,7 +11,8 @@ use think\Model;
* Date: 2019/3/14
* Time: 14:13
*/
class UAccountCheck extends Model{
class UAccountCheck extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_account_check';
private $db_;
......@@ -27,10 +30,10 @@ class UAccountCheck extends Model{
public function getCheckCount($params)
{
$where_arr = [];
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])){
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where_arr['create_time'] = array('between', array($params['create_time_start'], $params['create_time_end']));
}
if (!empty($params['user_phone']) ){
if (!empty($params['user_phone'])) {
$where_arr['user_phone'] = array("like", "%" . trim($params['user_phone']) . "%");
}
if (!empty($params['user_id'])) {
......@@ -62,7 +65,8 @@ class UAccountCheck extends Model{
return $result;
}
public function addCheck($params){
public function addCheck($params)
{
Db::startTrans();
$id = 0;
try {
......@@ -74,4 +78,18 @@ class UAccountCheck extends Model{
}
return $id;
}
public function updateCheck($id, $params)
{
Db::startTrans();
try {
$this->db_->where('id', $id)->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
}
return 0;
}
}
\ No newline at end of file
......@@ -430,7 +430,8 @@ Route::group('index', [
'couponList' => ['index/Coupon/couponList', ['method' => 'GET']],//获取活动
'userAccountBalanceList' => ['index/AccountBalance/userAccountBalanceList', ['method' => 'get|post']],//
'userAccountBalanceList' => ['index/AccountBalance/userAccountBalanceList', ['method' => 'get|post']],
'check' => ['index/AccountBalance/check', ['method' => 'get|post']],
]);
......
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 to comment