One-day-学习笔记-商品成交时发送短信,one-day-学习笔记_PHP教程

WBOY
풀어 주다: 2016-07-12 08:53:24
원래의
974명이 탐색했습니다.

One-day-学习笔记-商品成交时发送短信,one-day-学习笔记

                           个人学习笔记(one)

 

根据需求:商品成交时发送短信

html代码省略.....

Model代码省略.....

<span> 1</span>   <span>/*</span>
<span> 2</span> <span>     * -------------------------------------------------
</span><span> 3</span> <span>     * 修改状态 public 
</span><span> 4</span> <span>     * Author: lzp Time:2016-05-27
</span><span> 5</span> <span>     * -------------------------------------------------
</span><span> 6</span>      <span>*/</span>
<span> 7</span> 
<span> 8</span>     <span>public</span> <span>function</span><span> changeStateAction() {
</span><span> 9</span>         <span>$id</span> = <span>$_REQUEST</span>['id'<span>];
</span><span>10</span>         <span>$result</span> = <span>$this</span>->changeConfirmState(<span>$id</span><span>);
</span><span>11</span>         <span>if</span> (<span>$result</span><span>) {
</span><span>12</span>             <span>$this</span>->success("修改成功"<span>);
</span><span>13</span>         } <span>else</span><span> {
</span><span>14</span>             <span>$this</span>->error("修改失败"<span>);
</span><span>15</span> <span>        }
</span><span>16</span> <span>    }
</span><span>17</span> 
<span>18</span>     <span>private</span> <span>function</span> changeConfirmState(<span>$id</span><span>) {
</span><span>19</span>         <span>$reg</span> = <span>$this</span>->priceModel->selectPrice(['id'=>['eq', <span>$id</span><span>]]);
</span><span>20</span>         <span>$rel</span> = <span>$this</span>->demandModel->selectDemand(['id'=>['eq',<span>$reg</span>[0]['demand_id'<span>]]]);
</span><span>21</span>         <span>$demand_id</span>     = <span>$reg</span>[0]['demand_id'<span>];
</span><span>22</span>         <span>$reg</span>['demand'] = <span>$this</span>->priceModel->selectPrice(['demand_id'=>['eq',<span>$demand_id</span><span>]]);
</span><span>23</span>         <span>foreach</span> (<span>$reg</span>['demand'] <span>as</span> <span>$key</span> => <span>$value</span><span>){
</span><span>24</span>            <span>if</span>(<span>$value</span>['phone'] == <span>$reg</span>[0]['phone'<span>]){
</span><span>25</span>                <span>unset</span>(<span>$reg</span>['demand'][<span>$key</span><span>]);
</span><span>26</span>            }<span>else</span><span>{
</span><span>27</span>                <span>$new</span>[] = <span>$value</span>['phone'<span>];
</span><span>28</span> <span>           }
</span><span>29</span> <span>        }</span>
<span>31</span>         <span>$new</span> = ['0'=>'136********'<span>];
</span><span>32</span>         <span>if</span>((<span>time</span>()-<span>strtotime</span>(<span>$rel</span>[0]['create_time']))> 86400<span>){
</span><span>33</span>             <span>echo</span> "<script>alert('已超时!');history.back();</script>"<span>;
</span><span>34</span>             <span>die</span><span>;
</span><span>35</span>         }<span>else</span> <span>if</span>(<span>strtotime</span>(<span>$rel</span>[0]['finish_time'])>0<span>){
</span><span>36</span>             <span>echo</span> "<script>alert('已成交!');history.back();</script>"<span>;
</span><span>37</span>             <span>die</span><span>;
</span><span>38</span>         }<span>else</span><span>{
</span><span>39</span>             <span>$data_demand</span>      = [ 'is_available' => 2, 'finish_time'  => <span>date</span>("Y-m-d H:i:s"<span>) ];
</span><span>40</span>             <span>$result</span>['Price']  = <span>$this</span>->priceModel->savePrice( ['id'=>['eq',<span>$id</span>]], ['state'=>2<span>] );
</span><span>41</span>             <span>$result</span>['Demadn'] = <span>$this</span>->demandModel->saveDemand(['id'=>['eq',<span>$reg</span>[0]['demand_id']]] , <span>$data_demand</span><span>);
</span><span>42</span>             <span>$mobile</span> = <span>implode</span>(",", <span>$new</span><span>);
</span><span>43</span>             <span>$content</span> = "此条需求已成交,下次再来哟!"<span>;
</span><span>44</span>             smsApp(<span>$mobile</span>,<span>$content</span><span>); //发短信
</span><span>45</span>             <span>return</span> <span>$result</span><span>;
</span><span>46</span> <span>        }
</span><span>47</span>     }
로그인 후 복사

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1125061.htmlTechArticleOne-day-学习笔记-商品成交时发送短信,one-day-学习笔记 个人学习笔记(one) 根据需求:商品成交时发送短信 html代码省略..... Model代码省略.......
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿