Commit dae9a55b by 朱继来

调整样片列表

parent f2f7ae2f
Showing with 6 additions and 5 deletions
......@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
use App\Model\OrderModel;
class UserSampleApplyModel extends Model
{
......@@ -119,11 +120,11 @@ class UserSampleApplyModel extends Model
// 获取指定字段的总数
public function getSampleApplySum($user_id, $field='apply_num')
{
return $this->from('lie_user_sample_apply as s')
->join('lie_order as o', 's.order_id', '=', 'o.order_id')
->where('s.user_id', '=', $user_id)
->where('s.is_expire', '=', 1)
->where('o.status', '<>', '-1')
$order = OrderModel::where('user_id', $user_id)->where('status', '<>', -1)->lists('order_id')->toArray();
return $this->whereIn('order_id', $order)
->where('user_id', '=', $user_id)
->where('is_expire', '=', 1)
->whereIn('type', [1, 2])
->sum($field);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment