99 lines
3.0 KiB
PHP
99 lines
3.0 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\api\service\DecorateService;
|
|
use think\Db;
|
|
|
|
class Decorate extends Common
|
|
{
|
|
//装扮列表
|
|
public function get_decorate_list()
|
|
{
|
|
$type = input('type', 1);
|
|
$page = input('page', 1);
|
|
$page_limit = input('page_limit', 20);
|
|
$reslut = model('Decorate')->get_decorate_list($type, $page, $page_limit);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//装扮详情
|
|
public function get_decorate_info(){
|
|
$did = input('did', 0);
|
|
$reslut = model('Decorate')->get_decorate_info($did);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//购买装扮
|
|
// public function pay_decorate(){
|
|
// $uid = $this->uid;
|
|
// $did = input('did', 0);
|
|
// $num = input('num', 1);
|
|
// $keyname = "api:Decorate:pay_decorate:uid:".$uid;
|
|
// redis_lock_exit($keyname);
|
|
// $reslut = model('Decorate')->pay_decorate($uid, $did, $num);
|
|
// redis_unlock($keyname);
|
|
// return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
// }
|
|
//购买装扮
|
|
public function pay_decorate(){
|
|
$uid = $this->uid;
|
|
$did = input('did', 0);
|
|
$day = input('day', 1);
|
|
$keyname = "api:Decorate:pay_decorate:uid:".$uid;
|
|
redis_lock_exit($keyname);
|
|
$reslut = model('Decorate')->pay_decorate($uid, $did, $day);
|
|
redis_unlock($keyname);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//用户装扮列表
|
|
public function user_decorate_list(){
|
|
$uid = $this->uid;
|
|
$type = input('type', 1);
|
|
$page = input('page', 1);
|
|
$page_limit = input('page_limit', 20);
|
|
$reslut = model('UserDecorate')->user_decorate_list($uid, $type, $page, $page_limit);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//使用、放弃使用装扮
|
|
public function user_use_decorate(){
|
|
$uid = $this->uid;
|
|
$udid = input('udid', 0);
|
|
$keyname = "api:Decorate:user_use_decorate:uid:".$uid;
|
|
redis_lock_exit($keyname);
|
|
$reslut = model('UserDecorate')->user_use_decorate($uid, $udid);
|
|
redis_unlock($keyname);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//购买记录
|
|
public function user_pay_decorate_log(){
|
|
$uid = $this->uid;
|
|
$page = input('page', 1);
|
|
$page_limit = input('page_limit', 20);
|
|
$reslut = model('UserDecorate')->user_pay_decorate_log($uid, $page, $page_limit);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
|
|
public function get_cp_decorate_list(){
|
|
$uid = $this->uid;
|
|
$type = input('type', 1);
|
|
$reslut = model('UserDecorate')->get_cp_decorate_list($uid, $type);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |