ef60cd4d
Administrator
first commit
|
1
2
3
4
5
6
7
8
9
10
11
|
<?php
use Phalcon\Mvc\Model;
class SpyEvent extends \Phalcon\Mvc\Model
{
public function getSource()
{
return "spy_event";
}
|
f7818cdf
Administrator
change request to...
|
12
13
|
public function spyTimeAfter($project_id,$customer_id){
|
ef60cd4d
Administrator
first commit
|
14
15
16
17
18
19
|
return self::query()
->columns(['customer_id', 'st.id, st.item_id', 'st.item_name', 'st.item_image', 'st.quantity', 'st.price', 'st.item_url', 'st.item_image'])
->rightJoin('spyStore', 'st.spy_event_id = SpyEvent.id', 'st')
->where("project_id = :project_id:")
->andWhere("action ='order_add'")
->andWhere("customer_id =$customer_id")
|
f7818cdf
Administrator
change request to...
|
20
|
->bind(array("project_id" => $project_id))
|
ef60cd4d
Administrator
first commit
|
21
22
23
24
|
->execute();
}
|
f7818cdf
Administrator
change request to...
|
25
|
public function getSpyUsers($modelsManager, $project, $time)
|
2dfdc329
Administrator
change request to...
|
26
|
{
|
ef60cd4d
Administrator
first commit
|
27
28
|
$now = date("Y-m-d H:i:s");
|
ef60cd4d
Administrator
first commit
|
29
|
|
2dfdc329
Administrator
change request to...
|
30
|
$date1 = new DateTime($now);
|
f7818cdf
Administrator
change request to...
|
31
|
$date1->modify($time);
|
2dfdc329
Administrator
change request to...
|
32
33
|
$date1 = $date1->format('Y-m-d H:i:s');
|
2dfdc329
Administrator
change request to...
|
34
|
|
f7818cdf
Administrator
change request to...
|
35
36
|
$phql = "SELECT DISTINCT (customer_id) as id FROM SpyEvent WHERE project_id = {$project->id} AND action = 'order_add' AND date <= '{$date1}'";
//�������� ��� ���� ��� �������� �������
|
2dfdc329
Administrator
change request to...
|
37
|
// AND action = 'order_add' AND date <= '{$date}'
|
ef60cd4d
Administrator
first commit
|
38
39
40
41
42
|
return $modelsManager->executeQuery($phql)->toArray();
}
}
|