目录结构调整
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 分类模型
|
||||
*/
|
||||
class Book extends Content{
|
||||
|
||||
protected $auto = array('date_last_modify', 'user_last_modify');
|
||||
protected $type = array(
|
||||
'id' => 'integer',
|
||||
'cover_id' => 'integer',
|
||||
'sort' => 'integer'
|
||||
);
|
||||
|
||||
protected function setStatusAttr($value){
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected function setCreateTimeAttr($value){
|
||||
return $value ? strtotime($value) : time();
|
||||
}
|
||||
|
||||
protected function setDateLastModifyAttr($value){
|
||||
return $value ? strtotime($value) : time();
|
||||
}
|
||||
|
||||
protected function setUserLastModifyAttr($value){
|
||||
return session('user_auth.uid');
|
||||
}
|
||||
|
||||
protected function getCreateTimeAttr($value){
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
|
||||
protected function getDateLastModifyAttr($value){
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
|
||||
protected function getStandClassTextAttr($value, $data){
|
||||
$text = array(
|
||||
'1' => 'BK ', '2' => 'CN', '3' => 'QT', '4' => 'DB',
|
||||
);
|
||||
return $text[$data['stand_class']];
|
||||
}
|
||||
}
|
||||
@@ -64,19 +64,6 @@ class Hooks extends Base {
|
||||
return $keylist;
|
||||
}
|
||||
|
||||
public function change($data){
|
||||
if (!empty($data)) {
|
||||
if ($data['id']) {
|
||||
$this->save($data,array('id'=>$data['id']));
|
||||
}else{
|
||||
$this->save($data);
|
||||
}
|
||||
}else{
|
||||
$this->error = "非法操作!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function addHooks($addons_name){
|
||||
$addons_class = get_addon_class($addons_name);//获取插件名
|
||||
if(!class_exists($addons_class)){
|
||||
@@ -94,5 +81,5 @@ class Hooks extends Base {
|
||||
return false;
|
||||
}
|
||||
$methods = get_class_methods($addons_class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 分类模型
|
||||
*/
|
||||
class Order extends Base{
|
||||
|
||||
protected $auto = array('update_time');
|
||||
protected $insert = array('create_time', 'uid', 'status'=>1, 'order_no');
|
||||
|
||||
protected function setOrderNoAttr($value){
|
||||
return 'SN'.date('YmdHis',time()).rand('1000','9999');
|
||||
}
|
||||
|
||||
protected function setUidAttr($value){
|
||||
return session('user_auth.uid');
|
||||
}
|
||||
|
||||
protected function getPayTypeTextAttr($value, $data){
|
||||
$type = array('wechat'=>'微信支付', 'alipay'=>'支付宝支付');
|
||||
return $type[$data['pay_type']];
|
||||
}
|
||||
protected function getPayStatusTextAttr($value, $data){
|
||||
$type = array(
|
||||
0 => '未付款',
|
||||
1 => '已付款',
|
||||
);
|
||||
return $type[$data['pay_status']];
|
||||
}
|
||||
|
||||
public function product(){
|
||||
return $this->hasMany('OrderProduct', 'order_no', 'order_no');
|
||||
}
|
||||
|
||||
//生成订单
|
||||
public function createOrder($data){
|
||||
$order_id = $this->save($data);
|
||||
foreach ($data['list'] as $key => $value) {
|
||||
$value['order_no'] = $this->data['order_no'];
|
||||
$value['product_id'] = $value['id'];
|
||||
unset($value['id']);
|
||||
$value['create_time'] = time();
|
||||
$value['update_time'] = time();
|
||||
$goods[] = $value;
|
||||
}
|
||||
db('OrderProduct')->insertAll($goods);
|
||||
return $order_id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user