模版切断
${mb_strimwidth($one['title'],0,86,'...')}
<!--{if trim(strip_tags($team['userreview']))}-->
资金流动信息表flow
橙券消费券 coupon
user
pay
team
/**************************************************************/
订单表`order`
id 2935
pay_id go-2935-1-uslx
$randid = strtolower(Utility::GenSecret(4, Utility::CHAR_WORD));
$pay_id = "go-{$order['id']}-{$order['quantity']}-{$randid}";
buy_id 2(项目203已购买人数,到现在为止)
team_id 203
state pay/unpay
static public function CreateFromCharge($money,$user_id,$time,$service='alipay'){
global $option_service;
if (!$money || !$user_id || !$time) return 0;
$pay_id = "charge-{$user_id}-{$time}";
$pay = Table::Fetch('pay', $pay_id);
if ( $pay ) return 0;
$order_id = ZOrder::CreateFromCharge($money,$user_id,$time,$service);
if (!$order_id) return 0;
//insert pay record
$pay = array(
'id' => $pay_id,
'order_id' => $order_id,
'bank' => $option_service[$service],
'currency' => 'CNY',
'money' => $money,
'service' => $service,
'create_time' => $time,
);
DB::Insert('pay', $pay);
ZCredit::Charge($user_id, $money);
//end//
//update user money;
$user = Table::Fetch('user', $user_id);
Table::UpdateCache('user', $user_id, array(
'money' => array( "money + {$money}" ),
));
$u = array(
'user_id' => $user_id,
'admin_id' => 0,
'money' => $money,
'direction' => 'income',
'action' => 'charge',
'detail_id' => $pay_id,
'create_time' => $time,
);
return DB::Insert('flow', $u);
}
/**************************************************************/
/**************************************************************/
最土团购支付成功但显示未付款
问题原因,由于在4月份的时候在数据做过一次清理,造成PAY和order数据表错误,进而系统生成重复性订单故无法正常完成支付。
解决办法。在order表后插入一个远远大于现有订单的ID,比如现在ID为8000,插入一个10000的ID,避开生成重复性ID区间。
PAY表操作可能会造成数据报错。请尽量避免。
PS:之前产生的ID没付款的也最好不要删除和支付,以免再次产生重复。
/**************************************************************/