作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

11

... ... @@ -248,4 +248,25 @@ class Order extends Api
if ($order['refund_status'] == 1) return self::setErrorInfo('正在申请退款中!');
if ($order['status'] == 1) return self::setErrorInfo('订单当前无法退款!');
}
/**
* 我的订单-评价
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="order_id", type="integer", required=true, description="订单ID")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
})
*/
public function appraise()
{
$post = $this->request->post();
if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
$this->error($this->model->getError());
}
}
}
... ...
... ... @@ -18,11 +18,8 @@ class Test extends Api
/**
* 测试方法
*/
public function test(){
$reason = config('site.refundreason') ?: [];//退款理由
$reason = str_replace("\r\n", "\n", $reason);//防止不兼容
$reason = explode("\n", $reason);
halt($reason);
public function test($user_id,$sup='+'){
\app\common\model\User::score($sup.$order['score'],$user_id,'测试');
}
... ...
... ... @@ -22,6 +22,7 @@ class User extends Api
public function _initialize()
{
parent::_initialize();
$this->model = model('app\common\model\User');
$this->user = $this->auth->getUser();
}
... ... @@ -40,7 +41,7 @@ class User extends Api
public function index()
{
// 当前用户信息
$user = $this->auth->getUser();
$user = $this->user;
$coupon_count = \app\common\model\UserCoupon::alias('uc')
->join('coupon c','c.id = uc.coupon_id')
->where('uc.user_id',$this->user['id'])
... ... @@ -73,8 +74,8 @@ class User extends Api
// $session = Wechat::miniProgram()->auth->session($code);
// // 自动注册用户
// $userInfo = json_decode(htmlspecialchars_decode($user_info), true);
// if (!$user = UserModel::get(['openid' => $session['openid']])) {
// $user = new UserModel;
// if (!$user = $this->model->get(['openid' => $session['openid']])) {
// $user = $this->model;
// $userInfo['openid'] = $session['openid'];
// }
// $userInfo['nickname'] = preg_replace('/[\xf0-\xf7].{3}/', '', $userInfo['nickname']);
... ... @@ -84,7 +85,7 @@ class User extends Api
$session = [
'openid' => $testopenid ?: 'test',
];
$user = UserModel::get(['openid' => $session['openid']]);
$user = $this->model->get(['openid' => $session['openid']]);
// 生成token (session3rd)
$guid = guidv4();// 生成一个不会重复的随机字符串
$timeStamp = microtime(true);// 当前时间戳 (精确到毫秒)
... ... @@ -143,7 +144,7 @@ class User extends Api
if (!Validate::regex($mobile, "^1\d{10}$")) {
$this->error(__('Mobile is incorrect'));
}
if (UserModel::where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) {
if ($this->model->where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) {
$this->error(__('Mobile already exists'));
}
// $result = Sms::check($mobile, $captcha, 'changemobile');
... ... @@ -176,7 +177,7 @@ class User extends Api
*/
public function scoreLog(){
$page = $this->request->request('page');
$list = UserModel::scoreLog($this->user['id'],$page);
$list = $this->model->scoreLog($this->user['id'],$page);
$this->success(__('成功'),compact('list'));
}
... ...
... ... @@ -54,7 +54,7 @@ class User extends Model
/**
* 积分记录
*/
public static function scoreLog($user_id,$page)
public function scoreLog($user_id,$page)
{
return ScoreLog::where('user_id',$user_id)
->order(['createtime' => 'desc'])
... ...