|
@@ -23,6 +23,11 @@ class Order extends Model
|
|
|
return $this->hasOne(OrderRefund::class, 'order_id');
|
|
|
}
|
|
|
|
|
|
+ public function orderTimescard()
|
|
|
+ {
|
|
|
+ return $this->hasOne(OrderTimescard::class, 'order_id');
|
|
|
+ }
|
|
|
+
|
|
|
public function orderGoods()
|
|
|
{
|
|
|
return $this->hasMany(OrderGoods::class, 'order_id');
|
|
@@ -85,7 +90,7 @@ class Order extends Model
|
|
|
$vo['Operatingcity_3'] = OperatingcityIncomelog::getorderIncome($vo['id'], 3);
|
|
|
}
|
|
|
|
|
|
- $vo['payment_code_name'] = Paymethod::get_paymethod_name($vo['payment_code']);
|
|
|
+ $vo['payment_code_name'] = paymentCode($vo['payment_code']);
|
|
|
$vo['member_nickname'] = $vo['member']['nickname'];
|
|
|
|
|
|
if (!empty($vo['orderGoods'])) {
|
|
@@ -97,17 +102,34 @@ class Order extends Model
|
|
|
}
|
|
|
|
|
|
if ($vo['is_times'] == 1) {
|
|
|
-
|
|
|
- if ($vo['timesdate']) {
|
|
|
- if ($vo['timestype'] == 1) {
|
|
|
- $vo['yue_time'] = '每月:' . $vo['timesdate'] . '号';
|
|
|
- } else {
|
|
|
- $vo['yue_time'] = '每周周:' . $vo['timesdate'];
|
|
|
+ $OrderTimescard = OrderTimescard::where('order_id', $vo['id'])->order('id asc')->select()->toArray();
|
|
|
+ if ($OrderTimescard) {
|
|
|
+ foreach ($OrderTimescard as $tcvo) {
|
|
|
+ if ($tcvo['yue_date']) {
|
|
|
+ if ($tcvo['timestype'] == 1) {
|
|
|
+ if ($vo['yue_time']) {
|
|
|
+ $vo['yue_time'] .= ';每月:' . $tcvo['yue_date'] . '号';
|
|
|
+ } else {
|
|
|
+ $vo['yue_time'] = '每月:' . $tcvo['yue_date'] . '号';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($vo['yue_time']) {
|
|
|
+ $vo['yue_time'] .= ';每周周:' . $tcvo['yue_date'];
|
|
|
+ } else {
|
|
|
+ $vo['yue_time'] = '每周周:' . $tcvo['yue_date'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($vo['yue_time'])) {
|
|
|
$vo['yue_time'] = '还没有预约时间';
|
|
|
}
|
|
|
- $vo['remain'] = OrderStaff::timesremain($vo['id']);
|
|
|
+
|
|
|
+ $vo['timesused'] = OrderTimescardRecord::timesused($vo['id']);
|
|
|
+ $vo['timesmum'] = OrderCard::timesmum($vo['id']);
|
|
|
+ $vo['remain'] = (int)($vo['timesmum'] - $vo['timesused']);
|
|
|
} else {
|
|
|
$vo['yue_time'] = time_ymd($vo['begin_time']) . '<br>' . date('H:i', $vo['begin_time']) . ' 到 ' . date('H:i', $vo['end_time']);
|
|
|
if ($vo['start_time']) {
|
|
@@ -148,6 +170,8 @@ class Order extends Model
|
|
|
$order['payment_code'] = $order_data['payment_code'];
|
|
|
$order['pay_from'] = $pay_from;
|
|
|
$order['points_order'] = (int)$order_data['is_PayPoints'];
|
|
|
+ $order['goodsgiftcard_id'] = (int)$order_data['goodsgiftcard_id'];
|
|
|
+
|
|
|
if ($order_data['distance']) {
|
|
|
$order['distance'] = $order_data['distance'];
|
|
|
}
|
|
@@ -178,10 +202,6 @@ class Order extends Model
|
|
|
$order['shipping_province_name'] = $data['shipping_province_name'];
|
|
|
$order['shipping_city_name'] = $data['shipping_city_name'];
|
|
|
$order['shipping_district_name'] = $data['shipping_district_name'];
|
|
|
- $order['shipping_city_id'] = (int) $data['shipping_city_id'];
|
|
|
- $order['shipping_district_id'] = (int) $data['shipping_district_id'];
|
|
|
- $order['shipping_province_id'] = (int) $data['shipping_province_id'];
|
|
|
-
|
|
|
$order['shipping_address'] = $data['shipping_address'];
|
|
|
$order['shipping_tel'] = $data['shipping_tel'];
|
|
|
$order['shipping_method'] = $data['shipping_method'];
|
|
@@ -210,11 +230,13 @@ class Order extends Model
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //购物卡抵扣
|
|
|
+ if (!empty($order_data['goodsgiftcard_id'])) {
|
|
|
+ $order['payment_code'] = 'goodsgiftcard_pay';
|
|
|
+ }
|
|
|
+
|
|
|
//次卡设置
|
|
|
$order['is_times'] = (int) $order_data['is_times'];
|
|
|
- if ($order['is_times'] == 1) {
|
|
|
- $order['timesmum'] = $data['goodss'][0]['timesmum'];
|
|
|
- }
|
|
|
|
|
|
//跑腿订单设置
|
|
|
$order['is_errands'] = (int) $data['is_errands'];
|
|
@@ -250,6 +272,44 @@ class Order extends Model
|
|
|
$odra .= '_m';
|
|
|
OrderCount::createuserdata($Orderdata);
|
|
|
|
|
|
+ $order['is_timing'] = (int) $order_data['is_timing'];
|
|
|
+ if (!empty($order['is_times'])) {
|
|
|
+ //var_dump($data['goodss']);
|
|
|
+ $GoodsGiftcardType = GoodsGiftcardType::find((int) $data['goodss'][0]['card_tid']);
|
|
|
+ if ($GoodsGiftcardType) {
|
|
|
+ $GoodsGiftcardType = $GoodsGiftcardType->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ OrderCard::create([
|
|
|
+ 'order_id' => $order_id,
|
|
|
+ 'ptype' => (int) $order['is_times'],
|
|
|
+ 'weid' => $Orderdata['weid'],
|
|
|
+ 'sid' => $Orderdata['sid'],
|
|
|
+ 'uid' => $Orderdata['uid'],
|
|
|
+ 'timesmum' => $data['goodss'][0]['timesmum'],
|
|
|
+ 'card_tid' => (int) $data['goodss'][0]['card_tid'],
|
|
|
+ 'name' => $goods['name'],
|
|
|
+ 'image' => $goods['image'],
|
|
|
+ 'facevalue' => (float) $GoodsGiftcardType['buy_price'] + $data['goodss'][0]['extraprice'],
|
|
|
+ 'balance' => (float) $GoodsGiftcardType['buy_price'] + $data['goodss'][0]['extraprice'],
|
|
|
+ 'timesmum' => (int) $data['goodss'][0]['timesmum'],
|
|
|
+ 'is_timing' => (int) $data['goodss'][0]['is_timing'],
|
|
|
+ 'timing_unit' => $data['goodss'][0]['timing_unit'],
|
|
|
+ 'color' => $GoodsGiftcardType['color'],
|
|
|
+ 'condition_type' => $GoodsGiftcardType['condition_type'],
|
|
|
+ 'use_goods' => $GoodsGiftcardType['use_goods'],
|
|
|
+ 'cat_ids' => $GoodsGiftcardType['cat_ids'],
|
|
|
+ 'use_goods' => $GoodsGiftcardType['use_goods'],
|
|
|
+ 'goods_ids' => $GoodsGiftcardType['goods_ids'],
|
|
|
+ 'min_price' => $GoodsGiftcardType['min_price'],
|
|
|
+ 'start_time' => $GoodsGiftcardType['start_time'],
|
|
|
+ 'end_time' => $GoodsGiftcardType['end_time'],
|
|
|
+ 'is_expire' => $GoodsGiftcardType['is_expire'],
|
|
|
+ 'is_use' => $GoodsGiftcardType['is_use'],
|
|
|
+ 'status' => 1,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
if (!empty($order['tuan_id'])) {
|
|
|
TuanFollow::add_follow([
|
|
|
'order_id' => $order_id,
|
|
@@ -262,13 +322,12 @@ class Order extends Model
|
|
|
//var_dump($data['goodss']);
|
|
|
foreach ($data['goodss'] as $goods) {
|
|
|
$goods_id = $goods['goods_id'];
|
|
|
-
|
|
|
if (!empty($goods_id)) {
|
|
|
OrderGoods::create([
|
|
|
'order_id' => $order_id,
|
|
|
'goods_id' => $goods_id,
|
|
|
'cat_id' => $goods['cat_id'],
|
|
|
- 'mgid' => $goods['mgid'],
|
|
|
+ 'card_tid' => $goods['card_tid'],
|
|
|
'name' => $goods['name'],
|
|
|
'model' => $goods['model'],
|
|
|
'image' => $goods['image'],
|
|
@@ -437,10 +496,9 @@ class Order extends Model
|
|
|
$order_history['notify'] = 1;
|
|
|
OrderHistory::create($order_history);
|
|
|
|
|
|
- //会员升级
|
|
|
+ //会员升级及
|
|
|
$good_ids = OrderGoods::getOrderGoodsids($order_id);
|
|
|
if ($good_ids) {
|
|
|
- $mgid = Goods::getmgid($good_ids);
|
|
|
if (empty($mgid)) {
|
|
|
$mag = MemberAuthGroup::whereIn('upgrade_goods_id', $good_ids)->order('id desc')->find();
|
|
|
$mgid = $mag->id;
|
|
@@ -451,6 +509,10 @@ class Order extends Model
|
|
|
Member::where('id', $order_info['uid'])->update(['gid' => $mgid]);
|
|
|
}
|
|
|
|
|
|
+ //购物卡结算佣金
|
|
|
+ if ($order_info['is_times'] == 3) {
|
|
|
+ self::settlement($order_id);
|
|
|
+ }
|
|
|
//更新购买赠送的积分
|
|
|
if (!empty($order_info['return_points'])) {
|
|
|
if ($order_info['return_points'] > 0) {
|
|
@@ -886,10 +948,6 @@ class Order extends Model
|
|
|
$data['shipping_city_name'] = empty($shipping['city_name']) ? '' : $shipping['city_name'];
|
|
|
$data['shipping_district_name'] = empty($shipping['district_name']) ? '' : $shipping['district_name'];
|
|
|
|
|
|
- $data['shipping_province_id'] = empty($shipping['province_id']) ? '' : $shipping['province_id'];
|
|
|
- $data['shipping_city_id'] = empty($shipping['city_id']) ? '' : $shipping['city_id'];
|
|
|
- $data['shipping_district_id'] = empty($shipping['district_id']) ? '' : $shipping['district_id'];
|
|
|
-
|
|
|
$data['shipping_address'] = empty($shipping['address']) ? '' : $shipping['address'];
|
|
|
}
|
|
|
}
|
|
@@ -1022,27 +1080,7 @@ class Order extends Model
|
|
|
$pay_points += $goods['totalPayPoints'];
|
|
|
$points_price += $goods['totalPointsPrice'];
|
|
|
$return_points += $goods['total_return_points'];
|
|
|
-
|
|
|
- $goods_data[] = array(
|
|
|
- 'goods_id' => $goods['goods_id'],
|
|
|
- 'name' => $goods['name'],
|
|
|
- 'sid' => $goods['sid'],
|
|
|
- 'cat_id' => $goods['cat_id'],
|
|
|
- 'mgid' => $goods['mgid'],
|
|
|
- 'model' => $goods['model'],
|
|
|
- 'image' => $goods['image'],
|
|
|
- 'sku' => $goods['sku'],
|
|
|
- 'timesmum' => $goods['timesmum'],
|
|
|
- 'quantity' => $goods['quantity'],
|
|
|
- 'time_amount' => $goods['time_amount'],
|
|
|
- 'subtract' => $goods['subtract'],
|
|
|
- 'price' => $goods['price'],
|
|
|
- 'is_points_goods' => $goods['is_points_goods'],
|
|
|
- 'is_commission' => (int) $goods['is_commission'],
|
|
|
- 'commission_method' => (int) $goods['commission_method'],
|
|
|
- 'commission_price' => (float) $goods['commission_price'],
|
|
|
- 'total' => $goods['total']
|
|
|
- );
|
|
|
+ $goods_data[] = $goods;
|
|
|
}
|
|
|
|
|
|
//使用优惠券
|
|
@@ -1161,17 +1199,6 @@ class Order extends Model
|
|
|
$order['shipping_province'] = $order['shipping_province_name'];
|
|
|
$order['shipping_city'] = $order['shipping_city_name'];
|
|
|
$order['shipping_district'] = $order['shipping_district_name'];
|
|
|
- $Area = new Area;
|
|
|
- if (!empty($order['shipping_province_id'])) {
|
|
|
- $order['shipping_province'] = $Area->get_area_name($order['shipping_province_id']);
|
|
|
- }
|
|
|
- if (!empty($order['shipping_city_id'])) {
|
|
|
- $order['shipping_city'] = $Area->get_area_name($order['shipping_city_id']);
|
|
|
- }
|
|
|
- if (!empty($order['shipping_district_id'])) {
|
|
|
- $order['shipping_district'] = $Area->get_area_name($order['shipping_district_id']);
|
|
|
- }
|
|
|
-
|
|
|
$addressdata = OrderAddress::where(['order_id' => $id, 'ptype' => 1])->find();
|
|
|
if (empty($addressdata)) {
|
|
|
$addressdata = Address::find($order['address_id']);
|
|
@@ -1241,17 +1268,38 @@ class Order extends Model
|
|
|
$order['ServiceTime'] = time_format($order['begin_time']) . '-' . date('H:i', $order['end_time']);
|
|
|
|
|
|
if ($order['is_times'] == 1) {
|
|
|
-
|
|
|
- if ($order['timesdate']) {
|
|
|
- if ($order['timestype'] == 1) {
|
|
|
- $order['ServiceTime'] = '每月:' . $order['timesdate'] . '号';
|
|
|
- } else {
|
|
|
- $order['ServiceTime'] = '每周周:' . $order['timesdate'];
|
|
|
+ $order['ServiceTime'] = "";
|
|
|
+ $OrderTimescard = OrderTimescard::where('order_id', $id)->order('id asc')->select()->toArray();
|
|
|
+ if ($OrderTimescard) {
|
|
|
+ foreach ($OrderTimescard as $tcvo) {
|
|
|
+ if ($tcvo['yue_date']) {
|
|
|
+ if ($tcvo['timestype'] == 1) {
|
|
|
+ if ($order['ServiceTime']) {
|
|
|
+ $order['ServiceTime'] .= ';每月:' . $tcvo['yue_date'] . '号,时间' . time_format($tcvo['yue_begin_time']) . '-' . date('H:i', $tcvo['yue_end_time']);
|
|
|
+ } else {
|
|
|
+ $order['ServiceTime'] = '每月:' . $tcvo['yue_date'] . '号,时间' . time_format($tcvo['yue_begin_time']) . '-' . date('H:i', $tcvo['yue_end_time']);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($order['ServiceTime']) {
|
|
|
+ $order['ServiceTime'] .= ';每周周:' . $tcvo['yue_date'] . ',时间' . time_format($tcvo['yue_begin_time']) . '-' . date('H:i', $tcvo['yue_end_time']);
|
|
|
+ } else {
|
|
|
+ $order['ServiceTime'] = '每周周:' . $tcvo['yue_date'] . ',时间' . time_format($tcvo['yue_begin_time']) . '-' . date('H:i', $tcvo['yue_end_time']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($order['ServiceTime'])) {
|
|
|
$order['ServiceTime'] = '还没有预约时间';
|
|
|
}
|
|
|
- $order['remain'] = OrderStaff::timesremain($order['id']);
|
|
|
+
|
|
|
+ $order['timesusedlist'] = OrderTimescardRecord::timesusedlist($id);
|
|
|
+ $order['timesremainlist'] = OrderTimescardRecord::timesremainlist($id);
|
|
|
+ $order['timesused'] = OrderTimescardRecord::timesused($id);
|
|
|
+ $order['timesmum'] = OrderCard::timesmum($id);
|
|
|
+
|
|
|
+ $order['remain'] = (int)($order['timesmum'] - $order['timesused']);
|
|
|
} else {
|
|
|
$order['ServiceTime'] = time_format($order['begin_time']) . '-' . date('H:i', $order['end_time']);
|
|
|
}
|
|
@@ -1281,6 +1329,7 @@ class Order extends Model
|
|
|
'logistics' => $logistics,
|
|
|
'histories' => $histories
|
|
|
);
|
|
|
+
|
|
|
$resdata['orderInfo']['is_timer'] = (int) $resdata['goods']['is_timer'];
|
|
|
return $resdata;
|
|
|
}
|
|
@@ -1297,19 +1346,44 @@ class Order extends Model
|
|
|
$errands = Config::getconfig('errands');
|
|
|
|
|
|
foreach ($orderList as &$vo) {
|
|
|
- if ($vo['is_times'] == 1) {
|
|
|
-
|
|
|
- if ($vo['timesdate']) {
|
|
|
- if ($vo['timestype'] == 1) {
|
|
|
- $vo['timeslabel'] = '服务时间,每月:' . $vo['timesdate'] . '号';
|
|
|
+ if ($vo['is_times'] > 0) {
|
|
|
+
|
|
|
+ if ($vo['is_times'] == 1) {
|
|
|
+ $OrderTimescard = OrderTimescard::where('order_id', $vo['id'])->order('id asc')->select()->toArray();
|
|
|
+ if ($OrderTimescard) {
|
|
|
+ foreach ($OrderTimescard as $tcvo) {
|
|
|
+ if ($tcvo['yue_date']) {
|
|
|
+ if ($tcvo['timestype'] == 1) {
|
|
|
+ if ($vo['timeslabel']) {
|
|
|
+ $vo['timeslabel'] .= ';每月:' . $tcvo['yue_date'] . '号';
|
|
|
+ } else {
|
|
|
+ $vo['timeslabel'] = '每月:' . $tcvo['yue_date'] . '号';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($vo['timeslabel']) {
|
|
|
+ $vo['timeslabel'] .= ';每周周:' . $tcvo['yue_date'];
|
|
|
+ } else {
|
|
|
+ $vo['timeslabel'] = '每周周:' . $tcvo['yue_date'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
- $vo['timeslabel'] = '服务时间,每周周:' . $vo['timesdate'];
|
|
|
+ $vo['timeslabel'] = '还没有预约时间';
|
|
|
}
|
|
|
- } else {
|
|
|
- $vo['timeslabel'] = '您还没有预约时间';
|
|
|
}
|
|
|
|
|
|
- $vo['remain'] = OrderStaff::timesremain($vo['id']);
|
|
|
+ $vo['timesused'] = OrderTimescardRecord::timesused($vo['id']);
|
|
|
+ $vo['timesmum'] = OrderCard::timesmum($vo['id']);
|
|
|
+ $vo['remain'] = (int)($vo['timesmum'] - $vo['timesused']);
|
|
|
+
|
|
|
+ $vo['minialias'] = substr($vo['order_num_alias'], -5);
|
|
|
+ $vo['styleno'] = substr($vo['order_num_alias'], -1);
|
|
|
+ if ($vo['styleno'] > 5) {
|
|
|
+ $vo['styleno'] = $vo['styleno'] - 5;
|
|
|
+ }
|
|
|
+
|
|
|
+ $vo['OrderCard'] = OrderCard::getinfobyorderid($vo['id']);
|
|
|
}
|
|
|
|
|
|
if ($vo['is_errands'] == 1) {
|
|
@@ -1439,65 +1513,69 @@ class Order extends Model
|
|
|
$order_history['notify'] = 1;
|
|
|
|
|
|
OrderHistory::create($order_history);
|
|
|
- Technical::setIncome($order_info);
|
|
|
- Store::setIncome($order_info);
|
|
|
- Operatingcity::setIncome($order_info);
|
|
|
- Tuanzhang::setIncome($order_info);
|
|
|
-
|
|
|
- //分销佣金处理
|
|
|
- $agent = Config::getconfig('agent');
|
|
|
- $share = Config::getconfig('share');
|
|
|
- if (!empty($agent['level'])) {
|
|
|
- $level = $agent['level'];
|
|
|
- }
|
|
|
- if (!empty($agent['is_rebate'])) {
|
|
|
- $is_rebate = $agent['is_rebate'];
|
|
|
- }
|
|
|
|
|
|
- if (!empty($level)) {
|
|
|
- //一层佣金
|
|
|
- if ($level > 0) {
|
|
|
- $firstpercent = $share['first'];
|
|
|
- if (!empty($firstpercent)) {
|
|
|
- $firstmember = Member::find($order_info['uid']);
|
|
|
+ //使用购物卡支付不结算佣金
|
|
|
+ if (empty($order_info['goodsgiftcard_id'])) {
|
|
|
+ Technical::setIncome($order_info);
|
|
|
+ Store::setIncome($order_info);
|
|
|
+ Operatingcity::setIncome($order_info);
|
|
|
+ Tuanzhang::setIncome($order_info);
|
|
|
+
|
|
|
+ //分销佣金处理
|
|
|
+ $agent = Config::getconfig('agent');
|
|
|
+ $share = Config::getconfig('share');
|
|
|
+ if (!empty($agent['level'])) {
|
|
|
+ $level = $agent['level'];
|
|
|
+ }
|
|
|
+ if (!empty($agent['is_rebate'])) {
|
|
|
+ $is_rebate = $agent['is_rebate'];
|
|
|
+ }
|
|
|
|
|
|
- if (!empty($firstmember)) {
|
|
|
- $firstmember = $firstmember->toArray();
|
|
|
- $firstmember['is_agent'] = Agent::is_agent($firstmember['id']);
|
|
|
- }
|
|
|
- if (!empty($is_rebate) && $firstmember['is_agent'] == 1) {
|
|
|
- $firstuid = $order_info['uid'];
|
|
|
- } else {
|
|
|
- $firstuid = $firstmember['pid'];
|
|
|
- }
|
|
|
+ if (!empty($level)) {
|
|
|
+ //一层佣金
|
|
|
+ if ($level > 0) {
|
|
|
+ $firstpercent = $share['first'];
|
|
|
+ if (!empty($firstpercent)) {
|
|
|
+ $firstmember = Member::find($order_info['uid']);
|
|
|
|
|
|
- Agent::setIncome($firstuid, $order_info, $firstpercent, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- //二层佣金
|
|
|
- if ($level > 1 && !empty($firstuid)) {
|
|
|
- $secondpercent = $share['second'];
|
|
|
- if (!empty($secondpercent)) {
|
|
|
- $secondmember = Member::find($firstuid);
|
|
|
- if (!empty($secondmember)) {
|
|
|
- $secondmember = $secondmember->toArray();
|
|
|
+ if (!empty($firstmember)) {
|
|
|
+ $firstmember = $firstmember->toArray();
|
|
|
+ $firstmember['is_agent'] = Agent::is_agent($firstmember['id']);
|
|
|
+ }
|
|
|
+ if (!empty($is_rebate) && $firstmember['is_agent'] == 1) {
|
|
|
+ $firstuid = $order_info['uid'];
|
|
|
+ } else {
|
|
|
+ $firstuid = $firstmember['pid'];
|
|
|
+ }
|
|
|
+
|
|
|
+ Agent::setIncome($firstuid, $order_info, $firstpercent, 1);
|
|
|
}
|
|
|
- if ((int) $secondmember['pid'] > 0) {
|
|
|
- Agent::setIncome($secondmember['pid'], $order_info, $secondpercent, 2);
|
|
|
+ }
|
|
|
+ //二层佣金
|
|
|
+ if ($level > 1 && !empty($firstuid)) {
|
|
|
+ $secondpercent = $share['second'];
|
|
|
+ if (!empty($secondpercent)) {
|
|
|
+ $secondmember = Member::find($firstuid);
|
|
|
+ if (!empty($secondmember)) {
|
|
|
+ $secondmember = $secondmember->toArray();
|
|
|
+ }
|
|
|
+ if ((int) $secondmember['pid'] > 0) {
|
|
|
+ Agent::setIncome($secondmember['pid'], $order_info, $secondpercent, 2);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //三层佣金
|
|
|
- if ($level > 2 && !empty($secondmember['pid'])) {
|
|
|
- $thirdpercent = $share['third'];
|
|
|
- if (!empty($thirdpercent)) {
|
|
|
- $thirdmember = Member::find($secondmember['pid']);
|
|
|
- if (!empty($thirdmember)) {
|
|
|
- $thirdmember = $thirdmember->toArray();
|
|
|
- }
|
|
|
- if ((int) $thirdmember['pid'] > 0) {
|
|
|
- Agent::setIncome($thirdmember['pid'], $order_info, $thirdpercent, 3);
|
|
|
+ //三层佣金
|
|
|
+ if ($level > 2 && !empty($secondmember['pid'])) {
|
|
|
+ $thirdpercent = $share['third'];
|
|
|
+ if (!empty($thirdpercent)) {
|
|
|
+ $thirdmember = Member::find($secondmember['pid']);
|
|
|
+ if (!empty($thirdmember)) {
|
|
|
+ $thirdmember = $thirdmember->toArray();
|
|
|
+ }
|
|
|
+ if ((int) $thirdmember['pid'] > 0) {
|
|
|
+ Agent::setIncome($thirdmember['pid'], $order_info, $thirdpercent, 3);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1590,4 +1668,14 @@ class Order extends Model
|
|
|
$list['image'] = toimg($list['image']);
|
|
|
return $list;
|
|
|
}
|
|
|
+
|
|
|
+ public static function chackMiaoshamemberBuyMax($miaosha)
|
|
|
+ {
|
|
|
+ $Ordercount = Order::where('uid', UID())->where('ms_id', $miaosha['id'])->count();
|
|
|
+ if ($Ordercount >= $miaosha['member_buy_max']) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|