|
@@ -69,6 +69,52 @@ class Resource
|
|
return $this->handleInfo($info);
|
|
return $this->handleInfo($info);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ # 下单
|
|
|
|
+ public function pay_commit(){}
|
|
|
|
+ public function pay($info)
|
|
|
|
+ {
|
|
|
|
+ $order = array();
|
|
|
|
+ $order['uid'] = Place::$uid;
|
|
|
|
+ $order['name'] = $info['name'];
|
|
|
|
+ $prefix = strtoupper(substr($this->app, 0, 2));
|
|
|
|
+ if ($this->type == 3) {
|
|
|
|
+ $order['cash'] = $info['value'];
|
|
|
|
+ } else {
|
|
|
|
+ $order['cash'] = ($info['value']/Place::$info['score_per']);
|
|
|
|
+ }
|
|
|
|
+ $order['order_num'] = Dever::load('util', 'api')->createNumber($prefix, 'place/order');
|
|
|
|
+ $order['notify'] = 'place/callback.resource|' . Dever::input('p') . '|' . $order['order_num'] . '|' . $this->type;
|
|
|
|
+
|
|
|
|
+ $data['pay'] = Dever::load('account', 'place')->pay($order);
|
|
|
|
+ if ($data['pay'] && empty($data['pay']['link'])) {
|
|
|
|
+ $order['status'] = 1;
|
|
|
|
+ $order['type'] = $this->type;
|
|
|
|
+ $order['type_id'] = $info['id'];
|
|
|
|
+ $data['order_id'] = Dever::db('order', 'place')->insert($order);
|
|
|
|
+ $data['order_num'] = $order['order_num'];
|
|
|
|
+ if (isset($info['detail'])) {
|
|
|
|
+ $detail['order_id'] = $data['order_id'];
|
|
|
|
+ foreach ($info['detail'] as $k => $v) {
|
|
|
|
+ $detail['type'] = $this->type;
|
|
|
|
+ $detail['type_id'] = $v['id'];
|
|
|
|
+ if (isset($v['sku_id'])) {
|
|
|
|
+ $detail['sku_id'] = $v['sku_id'];
|
|
|
|
+ }
|
|
|
|
+ if (isset($v['sku_name'])) {
|
|
|
|
+ $detail['sku_name'] = $v['sku_name'];
|
|
|
|
+ }
|
|
|
|
+ $detail['pic'] = $v['pic'];
|
|
|
|
+ $detail['cash'] = $v['cash'];
|
|
|
|
+ $detail['num'] = $v['num'];
|
|
|
|
+ $detail['name'] = $v['name'];
|
|
|
|
+ $detail['pic'] = $v['pic'];
|
|
|
|
+ Dever::db('order_detail', 'place')->insert($detail);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $data;
|
|
|
|
+ }
|
|
|
|
+
|
|
# 同步资源,关联资源
|
|
# 同步资源,关联资源
|
|
public function relation($place_id, $data, $relation)
|
|
public function relation($place_id, $data, $relation)
|
|
{
|
|
{
|
|
@@ -191,8 +237,9 @@ class Resource
|
|
private function handleInfo($info)
|
|
private function handleInfo($info)
|
|
{
|
|
{
|
|
$info = Dever::load('info', $this->app)->getInfo($info);
|
|
$info = Dever::load('info', $this->app)->getInfo($info);
|
|
|
|
+ $info['pic'] = explode(',', $info['pic']);
|
|
$info['cdate_str'] = date('Y-m-d H:i:s', $info['cdate']);
|
|
$info['cdate_str'] = date('Y-m-d H:i:s', $info['cdate']);
|
|
- if (Place::$user['client_id'] > 0) {
|
|
|
|
|
|
+ if (Place::$uid && Place::$user['client_id'] > 0) {
|
|
$info['client'] = Dever::load('client', 'place')->get($info, $this->app, $this->type, '进货');
|
|
$info['client'] = Dever::load('client', 'place')->get($info, $this->app, $this->type, '进货');
|
|
}
|
|
}
|
|
$info['price'] = Dever::load('price', 'place')->get($info, $this->app, $this->type, '下载');
|
|
$info['price'] = Dever::load('price', 'place')->get($info, $this->app, $this->type, '下载');
|
|
@@ -211,6 +258,8 @@ class Resource
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$info['content'] = htmlspecialchars_decode($info['content']);
|
|
$info['content'] = htmlspecialchars_decode($info['content']);
|
|
|
|
+ } else {
|
|
|
|
+ $info['pic'] = $info['pic'][0] ?? '';
|
|
}
|
|
}
|
|
return $info;
|
|
return $info;
|
|
}
|
|
}
|