【增加】期货插件
This commit is contained in:
parent
0bc3cb6bd4
commit
8777ab75ea
|
|
@ -2,7 +2,74 @@
|
|||
|
||||
namespace addon\futures\model;
|
||||
use app\model\BaseModel;
|
||||
use think\facade\Cache;
|
||||
|
||||
class Futures extends BaseModel{
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @param array $condition
|
||||
* @param int $page
|
||||
* @param int $page_size
|
||||
* @param string $order
|
||||
* @param string $field
|
||||
* @param string $alias
|
||||
* @param array $join
|
||||
* @return array
|
||||
*/
|
||||
public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = 'a.*', $alias = 'a', $join = [])
|
||||
{
|
||||
$list = model('futures')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布
|
||||
* @return array
|
||||
*/
|
||||
public function release($futures_id, $price){
|
||||
$date = model('futures')->getInfo([['id', '=', $futures_id]]);
|
||||
if($date['status'] !== 1){
|
||||
return $this->error();
|
||||
}
|
||||
model('futures')->update([
|
||||
'status' => 2,
|
||||
'release_time' => time(),
|
||||
'price' => $price
|
||||
], [['id', '=', $futures_id]]);
|
||||
Cache::store('redis_concurrent')->set('addon_futures_'.$futures_id,'1');
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架到库存
|
||||
* @return array
|
||||
*/
|
||||
public function stock($futures_id){
|
||||
return $this->success(Cache::store('redis_concurrent')->delete('addon_futures_'.$futures_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单创建
|
||||
* @return array
|
||||
*/
|
||||
public function orderCreate(){
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单完成
|
||||
* @return array
|
||||
*/
|
||||
public function orderComplete(){
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单取消
|
||||
* @return array
|
||||
*/
|
||||
public function orderClose(){
|
||||
return $this->success();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue