- systemd and ansbile files added.
This commit is contained in:
@@ -47,6 +47,7 @@ func (c *OrderController) LoadPendingOrders() []*model.GoodsOrder {
|
|||||||
// msgVendorStatus的意思是事件本身的类型,类似有时收到NewOrder事件去取,订单状态不一定就是New的
|
// msgVendorStatus的意思是事件本身的类型,类似有时收到NewOrder事件去取,订单状态不一定就是New的
|
||||||
// OnOrderAdjust也类似,而OrderStatus要记录的是消息,所以添加这个
|
// OnOrderAdjust也类似,而OrderStatus要记录的是消息,所以添加这个
|
||||||
func (c *OrderController) OnOrderNew(order *model.GoodsOrder, msgVendorStatus string) (err error) {
|
func (c *OrderController) OnOrderNew(order *model.GoodsOrder, msgVendorStatus string) (err error) {
|
||||||
|
// todo transaction
|
||||||
db := orm.NewOrm()
|
db := orm.NewOrm()
|
||||||
if order.Status == model.OrderStatusUnknown {
|
if order.Status == model.OrderStatusUnknown {
|
||||||
order.Status = model.OrderStatusNew
|
order.Status = model.OrderStatusNew
|
||||||
@@ -66,6 +67,7 @@ func (c *OrderController) OnOrderNew(order *model.GoodsOrder, msgVendorStatus st
|
|||||||
|
|
||||||
// todo 调整单的处理可能还需要再细化一点,当前只是简单的删除重建
|
// todo 调整单的处理可能还需要再细化一点,当前只是简单的删除重建
|
||||||
func (c *OrderController) OnOrderAdjust(order *model.GoodsOrder, msgVendorStatus string) (err error) {
|
func (c *OrderController) OnOrderAdjust(order *model.GoodsOrder, msgVendorStatus string) (err error) {
|
||||||
|
// todo transaction
|
||||||
db := orm.NewOrm()
|
db := orm.NewOrm()
|
||||||
if order.Status == model.OrderStatusUnknown {
|
if order.Status == model.OrderStatusUnknown {
|
||||||
order.Status = model.OrderStatusNew
|
order.Status = model.OrderStatusNew
|
||||||
|
|||||||
13
deploy/ansible.yml
Normal file
13
deploy/ansible.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
- hosts: {{ deploy_hosts }}
|
||||||
|
remote_user: ubuntu
|
||||||
|
tasks:
|
||||||
|
- name: copy execute file to dest
|
||||||
|
copy:
|
||||||
|
src: jx-callback
|
||||||
|
dest: /jxdata/jx-callback/jx-callback
|
||||||
|
owner: ubuntu
|
||||||
|
group: ubuntu
|
||||||
|
mode: u=rwx, g=rx, o=r
|
||||||
|
- name: shell
|
||||||
|
shell: sudo systemctl restart jx-callback
|
||||||
20
deploy/jx-callback.service
Normal file
20
deploy/jx-callback.service
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=jx-callback service
|
||||||
|
Requires=mysql.service
|
||||||
|
After=network.target
|
||||||
|
After=mysql.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment="GOPATH=/home/ubuntu/go/"
|
||||||
|
Type=simple
|
||||||
|
User=ubuntu
|
||||||
|
Group=ubuntu
|
||||||
|
|
||||||
|
Restart=always
|
||||||
|
RestartSec=500ms
|
||||||
|
|
||||||
|
WorkingDirectory=/jxdata/jx-callback
|
||||||
|
ExecStart=/bin/sh -c '/jxdata/jx-callback/jx-callback >> /jxdata/jx-callback/jx-callback.log 2>&1'
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user