Commit dae9a55b by 朱继来

调整样片列表

parent f2f7ae2f
Showing with 6 additions and 5 deletions
...@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model; ...@@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model;
use Request; use Request;
use Excel; use Excel;
use DB; use DB;
use App\Model\OrderModel;
class UserSampleApplyModel extends Model class UserSampleApplyModel extends Model
{ {
...@@ -119,11 +120,11 @@ class UserSampleApplyModel extends Model ...@@ -119,11 +120,11 @@ class UserSampleApplyModel extends Model
// 获取指定字段的总数 // 获取指定字段的总数
public function getSampleApplySum($user_id, $field='apply_num') public function getSampleApplySum($user_id, $field='apply_num')
{ {
return $this->from('lie_user_sample_apply as s') $order = OrderModel::where('user_id', $user_id)->where('status', '<>', -1)->lists('order_id')->toArray();
->join('lie_order as o', 's.order_id', '=', 'o.order_id')
->where('s.user_id', '=', $user_id) return $this->whereIn('order_id', $order)
->where('s.is_expire', '=', 1) ->where('user_id', '=', $user_id)
->where('o.status', '<>', '-1') ->where('is_expire', '=', 1)
->whereIn('type', [1, 2]) ->whereIn('type', [1, 2])
->sum($field); ->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